Vincenzo's hacks » Amazon EC2 http://vincenzo-ampolo.net hacks, researches, thoughts Wed, 09 Oct 2013 21:27:22 +0000 en-US hourly 1 http://wordpress.org/?v=3.6.1 How to create an Amazon EC2 (cloud) instance of ubuntu server http://vincenzo-ampolo.net/2010/11/25/how-to-create-an-amazon-ec2-cloud-instance-of-ubuntu-server/ http://vincenzo-ampolo.net/2010/11/25/how-to-create-an-amazon-ec2-cloud-instance-of-ubuntu-server/#comments Thu, 25 Nov 2010 10:15:54 +0000 vampolo http://goshawknest.wordpress.com/?p=115 Amazon EC2 is the largest and most known public cloud available. It’s known for it’s availability, reliability and, the most important, scalability. With Amazon EC2 anyone can deploy a very large infrastructure lowering costs and without caring of having a datacenter. The best of the EC2 cloud is that it can easily be adapted to every need and can handle traffic bursts in a very efficient way.
In this document I’ll explain how to set up a small ubuntu server. I’ll explain how to login into the instance and how to reach the webserver which is running in the instance.

To accomplish all the steps of this tutorial you need to install the ElasticFox plugin for Firefox. To install the plugin is as easy as installing any other plugin: just download the plugin and double click on it or drag and drop in the extensions window of Firefox.

The last requirement is a valid Amazon aws account. A valid aws (Amazon Web Services) account is an already created account from the Amazon aws website. It’s free and you need a valid email address to make one.

After loggin in with the aws account you need to go to the Account->Developers->Security Credentials menu to and create an aws access key. The key in the only mandatory requirement to make ElasticFox working. The image below shows how to create a valid Access key.

In upper image, the valid key is the newest one. You need both the Amazon Key id and the Generated access key.

Now you can open the elasticfox plugin which is in the Tools menu of Firefox. When started for the first time, ElasticFox will ask for Amazon AWS credentials you have just created. Just click yes to set the credentials: they are both the Amazon Key id and the Generated access key.

To be able to use ssh on your machine you need to generate a key pairs, it can be easily done using ElasticFox like in the following screenshots:

After clicking on the green button you will be able to fill the only required field. Just give a name you want.

The key must be saved under the ec2-keys under your home directory. The key will be saved asĀ id_CERTNAME. Do not modify this parameter.

Since we wanna be able to login to the machine using ssh and be able to view pages served by a webserver in the machine we need to open port 22 and 80 on the machine. To do so we need to modify the security group a machine is running. Just go to the Security Groups tab and in group permissions add an entry for both port 22 and 80. As a host put 0.0.0.0 so it’s allowed for anyone on the internet.

At the end the group permissions will appear like these:

Now we can start our first amazon instance. To do so you need to select a valid AMI. Amazon AMI are a set of rootfs images which are ready to be run. To launch an official Ubuntu 10.10 instance we need the correct AMI code. All the AMIs for ubuntu are provided from ubuntu itself and are available at http://uec-images.ubuntu.com/releases/10.10/release/ . After getting the ami code, it’s easy to fill the search field in elasticfox and find the correct ami. When done, select the ami and click on Launch instance as the image shows.

A new window pops out, you just need to check that the fields are like these:

And then click launch.

Well done! Your Amazon E2C instance is running! After a while your ami will show a running stage like in this image.

Now let’s try to go into the machine using ssh. To be able to login we need the public DNS address of our instance. You can obtain this information just right clicking the running istance and selecting Copy public DNS name to clipboard like in the following figure.

To connect just digit on a terminal:


ssh -i ec2-keys/id_vincenzoampolo [email protected]

Where ec2-184-73-2-12.compute-1.amazonaws.com is the public DNS name of the running instance copied in the clipboard in the previous step. After being logged in and installed the cherokee webserver, you are this able to access it directly from http://ec2-184-73-2-12.compute-1.amazonaws.com/

]]>
http://vincenzo-ampolo.net/2010/11/25/how-to-create-an-amazon-ec2-cloud-instance-of-ubuntu-server/feed/ 6