I try to list all instances in account, using code:
for region in boto.ec2.regions(**creds):
print region.name
ec2_conn = boto.ec2.connect_to_region(region.name, **creds)
for instance in ec2_conn.get_only_instances():
print instance
But it fails when checking region "us-gov-west-1" with error:
boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized
AuthFailure
AWS was not able to validate the provided access credentialsc873c473-c3b1-4be3-b562-b2e73b21e9c2
As I understand that region is some special goverment region not allowed for me to use. But how than ignore it? I can just wrap my loop in try ... except
but may be there is some way to get the list of only accessible regions?
UPD: When iterating throught regions with following code:
ec2_conn = boto.ec2.connection.EC2Connection(**creds)
for region in ec2_conn.get_all_regions():
gives no "us-gov-west-1" region. But why this methods give different results and when each should be used?