Last active
August 29, 2015 14:04
-
-
Save krallin/4137f6b06dcc47ab3340 to your computer and use it in GitHub Desktop.
AWS API Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2 | |
# Connect to EC2 | |
conn = boto.ec2.connect_to_region("us-east-1") # Credentials are in the environment! | |
# Create a new SG | |
security_group = conn.create_security_group("test-sg, "Just making a point!") | |
# Define SG rules | |
ip_rules = [("tcp", 80, "0.0.0.0/0"), ("tcp", 443, "0.0.0.0/0")] | |
# Update the SG with the rules | |
for protocol, port, network in ip_rules: | |
security_group.authorize(protocol, port, port, network) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment