Rohit Gupta
Developer @plivo
@rohit01
1 min. Say the topic
2 min. Dont look at slide. Seamless!
1 min. Elaborate topics in full file
3 min. Traditional datacenters require frequent update. With AWS its just a matter of calling the API
5 min. 3 in US, 1 EU, 1 Singapore, 1 SA, 1 Tokyo
1 from boto.ec2 import connect_to_region
2 def get_connection(region):
3 conn = connect_to_region(
4 region_name=region,
5 aws_access_key_id='<AWS_ACCESS_KEY_ID>',
6 aws_secret_access_key='<AWS_SECRET_ACCESS_KEY>'
7 )
8 return conn
9
10 def launch_instance(region, ami_image_id):
11 conn = get_connection(region)
12 conn.run_instances(ami_image_id)
1 def launch_instance(region, ami_image_id):
2 conn = get_connection(region)
3 reservation = conn.run_instances(ami_image_id)
4 instance = reservation.instances[0]
5 print instance.id
1 def get_ami_id(region, role):
2 conn = get_connection(region)
3 my_images = conn.get_all_images(owners='<ACCOUNT_NO>')
4 for image in my_images:
5 if image.tags['role'] == role:
6 return image.id
7 return None
1 def get_ami_id(region, role):
2 conn = get_connection(region)
3 my_images = conn.get_all_images(owners='<ACCOUNT_NO>')
4 for image in my_images:
5 if image.tags['role'] == role:
6 return image.id
7 return None
1 def launch_instance(region, role):
2 conn = get_connection(region)
3 ami_id = get_ami_id(region, role)
4 reservation = conn.run_instances(ami_id)
5 instance = reservation.instances[0]
6 instance.add_tag('role', role)
7 print 'Instance launched!'
Rohit Gupta
Developer @plivo
Email: [email protected]
Ph: +91-8496035658
Slide link: https://bit.ly/plivoaws
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |