Friday 27 June 2014

Code snippet: Adding a security group egress rule in boto

Quick example of adding an egress rule to an existing security group (turns out cidr_ip is actually required). Assumes you have boto installed and your AWS credentials configured:

import boto
c = boto.connect_ec2()
c.authorize_security_group_egress('sg-xxxxxxx', 'tcp', from_port=1024, to_port=1024, cidr_ip='0.0.0.0/0')