Here is my slightly inelegant but working code to connect to specific region without setting up a configuration file or altering the default in the library (the access keys you can find under the tab security credentials on :
aaaa = your AWS Access key
sssss = your Secret Amazon key
from boto.ec2.connection import EC2Connection
default_conn = EC2Connection('aaaaa','sssss')regions = default_conn.get_all_regions()
for r in regions:
print r.name
if r.name == 'eu-west-1':
conn = EC2Connection('aaaaa',’sssss',region =r)print regions
rs = conn.get_all_security_groups()
print rs
No comments:
Post a Comment