import boto.rds2
conn = boto.rds2.connect_to_region("us-east-1")
def status(conn):
response = conn.describe_db_instances()
instances=responses['DescribeDBInstancesResponse'] ['DescribeDBInstancesResult']
['DBInstances']
print(instances['Engine'])
I want to get information about rds instances using the following code . why am i not able to get it Engine= mysql/sqlserver?. I am getting a list of dictionaries to the response variable. i want the output to be stored in a dictionary or list so that i can easily access those variables later.
The following code should work for you:
def status(conn):
status_map = {}
response = conn.describe_db_instances()
instances = response['DescribeDBInstancesResponse']['DescribeDBInstancesResult']['DBInstances']
for instance in instances:
status_map[instance['DBInstanceIdentifier']] = instance['Engine']
return status_map