Created
July 16, 2011 21:29
-
-
Save numan/1086807 to your computer and use it in GitHub Desktop.
Create a load balancer using the boto API
This file contains hidden or 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
from boto.ec2.elb import ELBConnection | |
from boto.ec2.elb import HealthCheck | |
conn_elb = ELBConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY) | |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#module-boto.ec2.elb.healthcheck | |
hc = HealthCheck('healthCheck', | |
interval=20, | |
target='HTTP:80/index.html', | |
timeout=3) | |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#boto.ec2.elb.ELBConnection.create_load_balancer | |
lb = conn_elb.create_load_balancer('my-lb', | |
['us-east-1a', 'us-east-1b', 'us-east-1c'], | |
[(80, 80, 'http'), (443, 443, 'tcp')]) | |
lb.configure_health_check(hc) | |
#DNS name for your new load balancer | |
print "Map the CNAME of your website to: %s" % (lb.dns_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment