【问题标题】:how get status RDS instance by name with boto3如何使用 boto3 按名称获取状态 RDS 实例
【发布时间】:2019-12-30 12:46:38
【问题描述】:

伙计们 我有实例的特定名称,我需要使用 boto3 按名称获取可用/停止状态 RDS 实例。示例我可以列出所有具有 InstanceId 和状态的实例

rds = boto3.client('rds')
response = client.describe_db_instances()
for resp in response['DBInstances']:
    db_instance_id = resp['DBInstanceIdentifier']
    db_instance_status = resp['DBInstanceStatus']

但我有实例名称,例如 d2-pipelined4-pipeline,我只想在没有任何循环的情况下获得它们的状态

【问题讨论】:

  • 你是什么意思,without any cycle

标签: python amazon-web-services boto3 amazon-rds rds


【解决方案1】:

您需要知道 DBInstanceIdentifier 或 DBCluserIdentifier 才能获得所需的所有详细信息。

【讨论】:

  • 如果我知道 DBInstanceIdentifier 它将如何工作?
  • response = client.describe_db_instances(DBInstanceIdentifier=<name>) status = response['DBInstances'][0]['DBInstanceStatus']
  • @SudarshanRampuria 这对我有帮助:-)
猜你喜欢
  • 1970-01-01
  • 2016-11-02
  • 2018-12-13
  • 1970-01-01
  • 1970-01-01
  • 2015-09-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多