Search code examples
pythonamazon-web-servicesbotoamazon-emr

Error while connecting to a region under a profile


As per document region is also a parameter of boto.emr.EmrConnection class however, I get the follwoing error while making the connection: conn = boto.emr.EmrConnection(profile_name='profile_name', region='us-west-2')

File "C:\Python27\lib\site-packages\boto-2.38.0-py2.7.egg\boto\emr\connection.py", line 68, in init self.region.endpoint, debug, AttributeError: 'str' object has no attribute 'endpoint'

Any idea?


Solution

  • The method is expecting RegionInfo type for region, not string.

    So pass boto.ec2.get_region('us-west-2') instead of 'us-west-2'

    import boto.ec2
    boto.emr.EmrConnection(profile_name='profile_name', region=boto.ec2.get_region('us-west-2'))