AWS deployment log1: Dev environment setup

Readers beware, beyond this lies codes only

General setup

Installed Ubuntu 12.04LTS 64bit through a USB onto a 16GB SDcard using pendrivelinux

Plugged in an ethernet port.

Logged into linux ctrl-alt t for terminal and performed the following command to install built in wireless ethernet driver:

>>sudo apt-get update
>>sudo apt-get install bcmwl-kernel-source

Reboot the computer

Installed Google Chrome because Firefox is too heavy for my old HP dv2

Boto installation

Grabbed 2.3.0 from github: boto github

>>tar xvf boto-2.3.0.tar.gz
>>mkdir ~/Cloud
>>mv boto-2.3.0 ~/Cloud
>>cd ~/Cloud
>>sudo apt-get install python-pip
>>pip install -U boto
Login to AWS and get the Access Key ID and Secret Access Key
Create a file called .boto in the directory ~/
Paste the following:

[Credentials]
aws_access_key_id = Access key id
secret_access_key = Secret Access Key

EC2 Testing

Go back to ~/Cloud/boto-2.3.0

>>python

Type in the following code:

import boto
ec2 = boto.connect_ec2()
key_pair = ec2.create_key_pair('ec2-sample-key')  # only needs to be done once
key_pair.save('/Users/patrick/.ssh')
reservation = ec2.run_instances(image_id='ami-bb709dd2', key_name='ec2-sample-key')

# Wait a minute or two while it boots
for r in ec2.get_all_instances():
    if r.id == reservation.id:
        break
print r.instances[0].public_dns_name  # output: ec2-184-73-24-97.compute-1.amazonaws.com

$ chmod 600 ~/.ssh/ec2-sample-key.pem
$ ssh -i ~/.ssh/ec2-sample-key.pem ubuntu@ec2-184-73-24-97.compute-1.amazonaws.com

To be continued….

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>