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

Basic Send Message to MQ with Java and IBM MQ JMS

Basic Receive Message to MQ with Java and IBM MQ JMS