本文介绍了难以在AWS rds中查找区域名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用boto脚本获取AWS中所有rds实例的名称.我想编写一个Python脚本来获取所有区域,然后显示其dbinstances.
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.
推荐答案
以下内容应为您提供RDS的所有可用区域.
The following should give you all of the available regions for RDS.
import boto.rds
regions = boto.rds.regions()
这样会返回RegionInfo
个对象的列表.
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]
如果您随后想连接到一个特定区域,请说eu-west-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()
甚至:
conn = boto.rds.connect_to_region(region.name)
这篇关于难以在AWS rds中查找区域名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!