Using Python/Boto List number of instances associated with each Security Group in AWS

List number of instances associated with each Security Group

import boto

ec2 = boto.connect_ec2()

sgs = ec2.get_all_security_groups()

for sg in sgs:
    print(sg.id + '\t' + sg.name  + '\t\t\t' +  str(len(sg.instances())))


Comments

Post a Comment

Popular posts from this blog

ActiveMQ, easy to use open source message oriented middleware (MOM)

Basic Send Message to MQ with Java and IBM MQ JMS

MySQL Error Invalid Table or Database Name