根据我对boto.rds.dbinstance
类的理解,我应该能够read_replica_dbinstance_identifiers
从对象中获取一个命名的变量,但是我不能,我也不明白为什么。我想知道我做错了什么。
当我运行时,rds-describe-db-instances --quiet --show-xml
我绝对可以在 XML 中找到我的只读副本:
<ReadReplicaDBInstanceIdentifiers>
<ReadReplicaDBInstanceIdentifier>my-dbinstance-id-1</ReadReplicaDBInstanceIdentifier>
<ReadReplicaDBInstanceIdentifier>my-dbinstance-id-2</ReadReplicaDBInstanceIdentifier>
</ReadReplicaDBInstanceIdentifiers>
但是,当我使用 boto 通过如下所示的测试脚本获取相同的信息时,我得到:
AttributeError: 'DBInstance' object has no attribute 'read_replica_dbinstance_identifiers'
脚本如下所示:
import boto
dbinstanceid = 'my-dbinstance-id'
rds = boto.connect_rds()
instances = rds.get_all_dbinstances(dbinstanceid)
for i in instances:
for property, value in vars(i).iteritems():
print property, ": ", value
print "============================="
print i, " ", i.id
print "connection: ", i.connection
print 'db instance identifiers: ', i.ReadReplicaDBInstanceIdentifiers
print i.read_replica_dbinstance_identifiers
根据 pip,我的 boto 版本是:
名称:boto
版本:2.9.7
位置:/Library/Python/2.7/site-packages