Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何通过boto3按名称获取RDS实例的状态_Python_Amazon Web Services_Boto3_Amazon Rds_Rds - Fatal编程技术网

Python 如何通过boto3按名称获取RDS实例的状态

Python 如何通过boto3按名称获取RDS实例的状态,python,amazon-web-services,boto3,amazon-rds,rds,Python,Amazon Web Services,Boto3,Amazon Rds,Rds,伙计们 我有实例的特定名称,我需要使用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 =

伙计们 我有实例的特定名称,我需要使用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管道
d4管道
,我只想不经过任何循环就获得它们的状态

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

什么意思,
没有任何循环
?如果我知道DBInstanceIdentifier,它将如何工作?
response=client。描述\u db_实例(DBInstanceIdentifier=)status=response['DBInstanceStatus'][0]['DBInstanceStatus']
@SudarshanRampuria这对我有帮助:-)