Nishant Singh
Nishant Singh

Reputation: 3209

Difficulty in finding the Region names in AWS rds

How to get the names of all the rds instances in AWS using a boto script. I want to write a python script that fetches all the regions and then displays their dbinstances.

Upvotes: 1

Views: 804

Answers (1)

garnaat
garnaat

Reputation: 45856

The following should give you all of the available regions for RDS.

import boto.rds
regions = boto.rds.regions()

Which would return a list of RegionInfo objects like this.

[RegionInfo:us-east-1,
 RegionInfo:cn-north-1,
 RegionInfo:ap-northeast-1,
 RegionInfo:eu-west-1,
 RegionInfo:ap-southeast-1,
 RegionInfo:ap-southeast-2,
 RegionInfo:us-west-2,
 RegionInfo:us-gov-west-1,
 RegionInfo:us-west-1,
 RegionInfo:eu-central-1,
 RegionInfo:sa-east-1]

If you then wanted to connect to one particular region, say eu-west-1 you could do this:

region = regions[6]
conn = region.connect()

or even:

conn = boto.rds.connect_to_region(region.name)

Upvotes: 3

Related Questions