To make a connection to AWS EC2 with Python, we need to use the boto library. Today lesson, we will learn how to install boto library, connect ec2 and get the list of zones.
1. Download and install boto library
$ pip install boto
2. Creating a connection to EC2 and get the zone list
# importing the boto library import boto # connect to ec2 ec2 = boto.connect_ec2(aws_access_key_id='<your-access-key>', aws_secret_access_key='<your-secret-key>') # get all zones zone_list = ec2.get_all_zones() print(zone_list)
That’s it. I hope this will help. 🙂