diff options
Diffstat (limited to 'boto/ec2/__init__.py')
-rw-r--r-- | boto/ec2/__init__.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/boto/ec2/__init__.py b/boto/ec2/__init__.py index c3976da1..cdf0916d 100644 --- a/boto/ec2/__init__.py +++ b/boto/ec2/__init__.py @@ -25,6 +25,7 @@ service from AWS. """ from boto.ec2.connection import EC2Connection from boto.regioninfo import RegionInfo, get_regions, load_regions +from boto.regioninfo import connect RegionData = load_regions().get('ec2', {}) @@ -61,11 +62,8 @@ def connect_to_region(region_name, **kw_params): and region_name == kw_params['region'].name: return EC2Connection(**kw_params) - for region in regions(**kw_params): - if region.name == region_name: - return region.connect(**kw_params) - - return None + return connect('ec2', region_name, + connection_cls=EC2Connection, **kw_params) def get_region(region_name, **kw_params): |