Difficulty in finding the Region names in AWS rds

ε祈祈猫儿з 提交于 2019-12-13 18:45:31

问题


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.


回答1:


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)


来源:https://stackoverflow.com/questions/28089057/difficulty-in-finding-the-region-names-in-aws-rds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!