graham_m_dunn

Dump SG rules for EC2

Apr 21st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. import boto.ec2
  2.  
  3. conn = boto.ec2.connect_to_region("us-east-1")
  4. groups = conn.get_all_security_groups()
  5. for group in groups:
  6.     print group.name
  7.     for rule in group.rules:
  8.         print rule.ip_protocol, rule.from_port, rule.to_port, rule.grants
Add Comment
Please, Sign In to add comment