Paginate DB cluster responses in AWS RDS dynamic inventory

This commit is contained in:
Ryan S. Brown 2016-08-15 14:27:48 -04:00
parent 59e499f8f0
commit 0783c172d7
2 changed files with 8 additions and 2 deletions

View file

@ -83,7 +83,7 @@ all_instances = False
all_rds_instances = False all_rds_instances = False
# Include RDS cluster information (Aurora etc.) # Include RDS cluster information (Aurora etc.)
include_rds_clusters = True include_rds_clusters = False
# By default, only ElastiCache clusters and nodes in the 'available' state # By default, only ElastiCache clusters and nodes in the 'available' state
# are returned. Set 'all_elasticache_clusters' and/or 'all_elastic_nodes' # are returned. Set 'all_elasticache_clusters' and/or 'all_elastic_nodes'

View file

@ -597,7 +597,13 @@ class Ec2Inventory(object):
"getting RDS clusters") "getting RDS clusters")
client = ec2_utils.boto3_inventory_conn('client', 'rds', region, **self.credentials) client = ec2_utils.boto3_inventory_conn('client', 'rds', region, **self.credentials)
clusters = client.describe_db_clusters()["DBClusters"]
marker, clusters = '', []
while marker is not None:
resp = client.describe_db_clusters(Marker=marker)
clusters.extend(resp["DBClusters"])
marker = resp.get('Marker', None)
account_id = boto.connect_iam().get_user().arn.split(':')[4] account_id = boto.connect_iam().get_user().arn.split(':')[4]
c_dict = {} c_dict = {}
for c in clusters: for c in clusters: