Setting Up An EC2 Instance With IAM Role And Python Boto SDK

1. We just have to create a ROLE using AWS IAM console as below.

2. Launch  an  instance with that  role(ec2-admin) and that's it . From that instance you can do what ever operation you want like from creating S3 bucket and creating Route53 hosted zone or creating Elastic LoadBalancer  or what ever service you want to call you can do that from that EC-2 instance and most importantly you no need to specify the ACCESS_KEY and SECRET ACCESS_KEY to access the aws services.

3.You just have to install python boto SDK in that  instance and just call s3 service as below using a simple python file i.e.

#yum install -y python-pip
#pip install boto (or)

git clone git://
cd boto
python install

That's more than enough.
Just create a python file as below and run it as ./

[root@ip-10-0-1-6 boto]# cat
#! /usr/bin/python
import boto
conn = boto.connect_s3()
bucket = conn.create_bucket('hanumansjan24_2016')

[root@ip-10-0-1-6 boto]#

Just Run it as below S3 bucket named hanumansjan24_2016 has been created.
[root@ip-10-0-1-6 boto]# ./
[root@ip-10-0-1-6 boto]#  


Popular posts from this blog

How to check the hardware information in Linux Systems?

Ansible for Devops

All About Amazon Web Services(AWS)