Posts

Showing posts from 2016

python in liunx

           Installing Python-3 ,Running the Python interactive-console,Passing arguments to a script  Installing python-3 in centos-6 in Traditional Way and using yum Before this just add an EPEL repo to your cent-os yum list. Traditional way # yum install gcc  --> Its a just dependency package Down load here # cd /usr/src # wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz Now extract the downloaded package. # tar xzf Python-3.4.3.tgz # cd Python-3.4.3 # ./configure # make altinstall make altinstall is used to prevent replacing the default python binary file /usr/bin/python. Now remove downloaded source archive file from your system # rm Python-3.4.3.tgz Check the latest version installed of python using below command # python3.4 -V Python 3.4.3   Using yum package: #sudo yum install https://centos6.iuscommunity.org/ius-release.rpm #sudo yum search python3 Most probably, you would install Python 3.4: #sudo yum install python34u # python3.4 -V Python 3.4.3  

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

Image
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. sample.py #yum install -y python-pip #pip install boto (or) git clone git://github.com/boto/boto.git cd boto python setup.py 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 sample.py #! /usr/bin/python import boto conn = boto.connect_s3() bucket = conn.create_bucket('hanumansjan24_2016') [root@