我正在尝试连接并动态获取特定 AWS 区域中 AWS CloudWatch 中可用的所有服务的所有指标:
try:
print "Connecting to region %s" % (args.region)
conn = boto.connect_cloudwatch()
#conn = boto.ec2.cloudwatch.connect_to_region(args.region)
print "Retrieving all CloudWatch metrics"
metrics = conn.list_metrics()
print "Collected %d metrics" % (len(metrics))
except boto.exception.BotoServerError, error:
print "Failed to connect to AWS\n ->%s" % (error)
sys.exit(1)
不幸的是boto.ec2.cloudwatch.connect_to_region(args.region)
,只给我一个区域的 EC2 指标,我无法从文档中弄清楚如何将区域指定为conn = boto.connect_cloudwatch()
. 请帮忙!