Created
January 19, 2012 00:57
-
-
Save joet3ch/1636904 to your computer and use it in GitHub Desktop.
Use fabric with dynamic auto scaling
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
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