Monday, 10 April 2017

Launching an EC2 instance in aws using Python

#/usr/bin/python
import boto.ec2
conn = boto.ec2.connect_to_region("us-west-2")
conn.run_instances(
    'ami-6ac2a85a',
    key_name='nitheesh_oregon',
    instance_type='t1.micro',
    security_groups=['nitheesh_oregon']
)
 
 
 
The above python script will connect to Amazon’s us-west region and launch an instance using AMI id: ami-6ac2a85a.

No comments:

Post a Comment