简体   繁体   中英

AWS Default region not setting using env variable in boto

Python terminal below

In [3]: os.environ['AWS_DEFAULT_REGION']
Out[3]: 'us-west-2'

In [4]: import boto

In [5]: boto.connect_ec2()
Out[5]: EC2Connection:ec2.ap-southeast-1.amazonaws.com

AWS Default region is not getting set even after using AWS_DEFAULT_REGION as env variable. Please suggest !

Solution:

AWS_DEFAULT_REGION works only with boto3 . I was using boto2 . Environment variables for region is not supported in boto2 .

Updating the boto.cfg fixed the problem .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM