how to get list of RDS names by passing vpc

Viewed 77

I am looking to get the list of all RDS cluster names when i pass a "vpc-id" as input. I can only see the function "describe_vpcs" available. Any other function available to fulfil my requirement? please advise

1 Answers

you can use this code:

import boto3
client = boto3.client('rds')

vpc_id = input('vpc-id: ')
response = client.describe_db_instances()
for instance in response['DBInstances']:
    VPC_ID = instance['DBSubnetGroup']['VpcId']
    DBId = instance['DBInstanceIdentifier']
    if vpc_id == VPC_ID:
        print(DBId)
Related