Skip to content

Instantly share code, notes, and snippets.

@joet3ch
Created January 19, 2012 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joet3ch/1636904 to your computer and use it in GitHub Desktop.
Save joet3ch/1636904 to your computer and use it in GitHub Desktop.
Use fabric with dynamic auto scaling
def web_cluster():
env.user = 'ubuntu'
env.key_filename = ['mykey.pem']
env.conftype = 'prod'
env.project = 'sample'
ec2conn = ec2.connection.EC2Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
web_group = ec2conn.get_all_security_groups(groupnames=['web'])
for i in web_group[0].instances():
hostname = i.__dict__['public_dns_name']
if hostname is not '':
env.hosts.append(hostname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment