9lessons programming blog
Loading Search
Wednesday, September 14, 2011

Amazon EC2 Cloud Installation.

Last few days I have been working with Amazon Web Services micro instance free tier, this post I want to explain how to setup instance, elastic IP configuration, cloud instant accessing from local computer using Putty and FTP connection. It’s awesome real cloud computing, you have complete control on server, using this we can implement new web features like node.js. Soon I’m hosting all of my demos into EC2.

Amazon EC2 Cloud Installation

Getting started with Amazon Elastic Compute Cloud(EC2)
Amazon providing 720 hours free tier micro instance box. Very first you have to create an account in Amazon.com with valid credit card and then activate micro free tie. Click here to access Amazon console dashboard.


amazon ec2 cloud installation

Step 1
Go to left panel EC2 Dashboard -> NETWORK & SECURITY -> Key Pairs
amazon ec2 cloud installation

Creating Key Pair - Authentication
Most important part in this installation process. Click Create Key Pair button.
Step 2
amazon ec2 cloud installation

Step 3
Give some key pair name. Eg:9lessons
amazon ec2 cloud installation

Step 4
9lessons key pair has been created.
amazon ec2 cloud installation

Step 5
You will get download save alert, save the .pem signature file into local directory Eg: D:/.
amazon ec2 cloud installation

Step 6
Amazon EC2 dashboard will show created Key Pair and Fingerprint.
amazon ec2 cloud installation

Security Groups -> Firewall

Step 7
By default Amazon providing default security group, I recommend use the default firewall or you can create new security group like eg: Egglabs.
amazon ec2 cloud groups installation

Default firewall allowed ports.
amazon ec2 cloud groups installation

Step 8
If you want you can allow new port by adding here
amazon ec2 cloud Groups installation

Instance -> Cloud Box

Step 9
Create instance here EC2 Dashboard -> INSTANCES -> Instances
amazon ec2 cloud instance installation

Step 10
Here you have to choose cloud server OPERATING SYSTEM.
amazon ec2 cloud linux installation

Step 11
You can search in Community AMIs. Start icon references to free tier for Micro box users.
amazon ec2 cloud Groups installation

I had selected Ubuntu Natty Operating System 11.04 server.
amazon ec2 cloud linux installation

Step 12
Instant details you can give any name.
amazon ec2 cloud Groups installation

Step 13
Now you have to choose type of instance small,medium and large. Amazon providing Micro (Free tier) 30 days
amazon ec2 cloud Groups installation

Step 14
Here you have to select 9lesson key pair by selecting Your Existing Key Pairs
amazon ec2 cloud linux installation

Step 15
Configure firewall choose default security group.
amazon ec2 cloud Groups installation

Step 16
Now you instance cloud compute ready.
amazon ec2 cloud Groups installation

Step 17
Go to Amazon EC2 dashboard, here you can seen instance box running. You can  edit the instance box name.Eg:SrinivasBox
amazon ec2 cloud running instance

Step 18
Right click on the running instance and click connect.
amazon ec2 cloud connect

You will get connecting help alert.
amazon ec2 cloud instance connection

Elastic IP
Amazon EC2 instance only providing public DNS name, If you reboot existing instance box the public DNS name will change, using Elastic IP we can solve this problem DNS problem it's static.

Step 1
Clicking on Allocate New Address, amazon will provide you dedicated IP address.
amazon ec2 cloud Groups installation

Step 2
Choose EC2.
amazon ec2 cloud running instance

Step 3
Amazon generated an IP address, now map IP address to Instance box (Eg:SrinivasBox). While clicking on Associate Address button.
amazon ec2 cloud instance connection

Step 4
Associate instance and click YES button.
amazon ec2 cloud connect

Linux connect
Executing following command in Linux terminal you can directly access your box.
ssh -i KEY File username@publicDNSname.amazonaws.com
ssh -i 9lessons.pem ubuntu@publicDNSname.amazonaws.com

Windows connect using Putty
PuTTY is a free and open source terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console client.

Step 1
First you have to download Putty.exe and PuttyGen.ext into your PC click here and download
Putty software

Step 2
Run PuttyGen.exe click Conversions -> Import Key.
Putty software

Step 3
Choose 9lessons.pem the Key Pair.
Putty software

Step 4
In Parameters select Type of Key Generate SSH-1(RSA). Click Save private key.
Putty software

Same directory Puttygen will generate .ppk file (private key).
Putty software

Step 5
Now run Putty.exe host name give Elastic IP or Public DNS name(If no elastic IP) and choose connection type SSH
Putty software

Step 6
Authentication with private key.
Category -> Connection -> SSH -> Auth browse and select .ppk file the click Open button.
Putty software

Step 7
Instance cloud connected successfully.
Putty software

Execute following commands.

Update the Package
sudo apt-get update

Install Apache2
sudo apt-get install apache2

Install PHP5
sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

Install MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Install PhpMyAdmin
sudo apt-get install phpmyadmin

Restart Apache2
sudo /etc/init.d/apache2 restart

Now your web services is ready. You can upload your files into /var/www/ directory using FTP.

Access http://ElasticIP/. It works!

FileZilla - File Uploads
Using the open source FTP tool you can upload files into Amazon EC2 instance box. Download here and install into your PC.

Step 1
Select File-> Site Manager
amazon ec2 cloud Groups installation

Step 2
Give host name as your instance box Elastic IP and select Server Type SFTP-SSH File Transfer Protocol. Click OK not Connect
amazon ec2 cloud running instance

Step 3
Adding private key for instance cloud authentication. Edit -> Settings -> Connectin -> SFTP click Add keyfile button to browsed and choose existing .ppk file. Eg:9lessons.ppk
amazon ec2 cloud instance connection


amazon ec2 cloud Groups installation

Step 4
Now Got File-> Site Manager click Connect button.
amazon ec2 cloud running instance

Instance connected.
amazon ec2 cloud instance connection

Now you can upload files from local PC to Amazon EC2 Instance Cloud /var/www/ directory.
amazon ec2 cloud Groups installation

Hope you like it. Thanks!

Srinivas Tamada
Sponsored Links

Share this post

Comments
{ 39 comments }
Anonymous said...

Really nice article Srinivas. I liked that attention to detail in this article. Good work. Keep it up.

Thanks for sharing.

Vishal

Srinivas Tamada said...

@Vishal

Thank you

Anonymous said...

Nice Work Man

Anonymous said...

why do you use amazon web services. i'm not familiar this service. is it a standart web hosting service? why is it used?

Thank you

Farid said...

Thanks a lot. Great Article.

Anil Kumar Panigrahi said...

Nice post srinu, thank you for sharing ...

Anonymous said...

very nice Srinivas! :) can u do node.js in the future :D

Anonymous said...

Thanks. good article !

Diego said...

Excellent !!!!
I was looking for it !!

Seyed said...

Thanks. Good one.

Sandeep Verma said...

Great Srinivas :)

I am happy to see article of my choice ;)

Thanks

Anonymous said...

Hi, for some reason I can't see anything on browser, is everything setup and running ok, but when I'm try to access get an error

Anonymous said...

Nice tutorial. I just wish I had it when I set up my micro instance a few months back! ;-)

Edmund said...

thanks for this post!

Anonymous said...

I did all the steps, but I couldn't get beyond
Step 6: Authentication with private key. When I click open, the cmd pops up and after sometime it says "Network Error: Connection timed out"

Any help on this?

Vishal said...

Hi Srinivas
I have successfully setted up everything as instructed in this article but my elastic IP does not work in browser! Is there anything I will be missing here!
Thanks,
Vishal

Vishal said...

Hi Srinivas,
Just for your reference, if anybody else encounters this. I had two issues while setting up EC2.
1. I was not able to SSH into my EC2 instance via Putty. To resolve this, I had to add Port 22 in my Security Group (Port Range field)
2. I was not able to make http request via my elastic IP. To resolve this, I had to add port 80 in my Security Group(Port range field) which fixed the issue.

Vishal

ahmad fatih said...

Wow... that is complete article. I'm happy to subcribe your newsletter.

I'm new to this, the lack of this article is to describe what for/final goal we rent service in amazon EC2. Is it to host file for download, to make complete hosting etc?? i hope you explain this for the future newsletter, it can easily read for entire level.

btw, can we make our hosting to host website using amazon EC2, sell reseller space etc??

Anonymous said...

Srini....Thanks a lot....This tutorial helps me, to establish the key pair ssh connection in my rackspace cloud server.

Thanks Again,

Anonymous said...

Your articles are RELEVANT and VERY straight to the points.

Anonymous said...

Simple and clear , I thought setting EC2 is hard. But you made it to pieces.I gonna Share this article in my tuts blog :)

Anonymous said...

Nice tutorial.. I am unable to connect.. I followed exactly mentioned in this tutorial, but still can't connect using putty

Niju Mohan said...

Neat post. Good job. Looking forward to more posts...

Kim, Kiseok said...

Thank you for sharing. :)

Aaron D Williams said...

Great post. Thank you.

Vamsi said...

good one..you covered everything..

Seyed said...

i was not able to connect into my FTP. Srinivas can you help with it.

Ken Le said...

How many Instance EC2 , we can create FREE ?

Srinivas Tamada said...

720 Hours

Unknown said...

1 instance EC2, can run 720 hours FREE per month with 10GB Space, 15 GB traffic.

But i see, we can create many and many instance EC2 and create over 10GB Space without any alert from Amazon.

So, I don't know they will charge us or not.

But when we create more Instance EC2, they still show us Free Tier on micro :D

Motyar said...

This is really a very useful and unique post about this topic. Saved my lot of time. Thank you very much for sharing.
Wishes!!

Bishwajeet @Comptalks said...

Going to try the free version for sure :)

Mahaveer Gurjar said...

Thanks dear

tareq said...

thanks , amazing post .
how can i use my own domain name on Amazon EC2 ?

Hai Le said...

Thanks a lot

Anonymous said...

great article
THANKS

Sabir said...

Excellent Article Srinivas. We are planning to migrate to amazon and this would be really helpful.

Άγγελος Α. Αλεξόπουλος said...

Really great article Srinivas!!! Thanks a lot!

Anonymous said...

THIS WAS SO HELPFUL.

Most documentation online has not been very clear but following these steps worked great

Post a Comment

Subscribe now!Recent Posts

Categories

Subscribe now!Popular Posts

People Says

@9lessons thank you for the great tutorials, we truly appreciate your contributions to the design community.

Smashing Magazine

Like Me

follow me
products

9lessons labs

9lessons clouds

Android application

Chrome Extension