diff options
Diffstat (limited to 'boto/ec2/cloudwatch/__init__.py')
-rw-r--r-- | boto/ec2/cloudwatch/__init__.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/boto/ec2/cloudwatch/__init__.py b/boto/ec2/cloudwatch/__init__.py index 3bc806d9..b53d5695 100644 --- a/boto/ec2/cloudwatch/__init__.py +++ b/boto/ec2/cloudwatch/__init__.py @@ -29,6 +29,7 @@ from boto.ec2.cloudwatch.metric import Metric from boto.ec2.cloudwatch.alarm import MetricAlarm, MetricAlarms, AlarmHistoryItem from boto.ec2.cloudwatch.datapoint import Datapoint from boto.regioninfo import RegionInfo, get_regions, load_regions +from boto.regioninfo import connect import boto RegionData = load_regions().get('cloudwatch', {}) @@ -55,10 +56,8 @@ def connect_to_region(region_name, **kw_params): :return: A connection to the given region, or None if an invalid region name is given """ - for region in regions(): - if region.name == region_name: - return region.connect(**kw_params) - return None + return connect('cloudwatch', region_name, + connection_cls=CloudWatchConnection, **kw_params) class CloudWatchConnection(AWSQueryConnection): |