amazon web services - How can I retrieve more than 50 Autoscaling Groups via Python Boto -


hello , in advance help...

i trying use boto retrieve list of autoscaling groups in account. have 164 autoscaling groups boto script retrieving first 50 in similar fashion console.

    #!/usr/bin/python      boto.ec2.autoscale import autoscaleconnection     conn = autoscaleconnection('abcdefghijklmnopqrs', 'tuvwxyz/abcdefghijklmn')      agroups = conn.get_all_groups()     print agroups 

any ideas how can pull entire list of groups?

boto not automatically handle paging of results describeautoscalinggroups api call many other calls. have handle paging yourself.

import boto.ec2.autoscale c = boto.ec2.autoscale.connect_to_region('us-east-1')  # or whatever region want all_groups = [] rs = c.get_all_groups() all_groups.extend(rs) while rs.next_token:     rs = c.get_all_groups(next_token=rs.next_token)     all_groups.extend(rs) 

at end of loop, all_groups should contain of autoscaling groups. can come more elegant way of doing should work , gives basic info how paging.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -