Host a website on Amazon AWS step by step guide

1.Sign in to the console using AWS credentials.

You will see a page listing all AWS web services:

QQ20160515-0

 

 

2.Click on “EC2” to go to EC2 dashboard:QQ20160515-1

 

 

3.Click on “Launch Instance” to start the process of  creating a new EC2 instance:

QQ20160515-3

Notice: there should be a step to create security key pairs for later access to running EC2 instance. But since I’ve already created one in my account, the system skips the step. Just remember to save the private key to a safe place, we will need it to SSH into the instance later.

 

3.1Choose AMI

Here I will just choose the forth one: Ubuntu Server.

QQ20160515-4

 

3.2Choose Instance Type

Here just choose the default one:

QQ20160515-5

 

3.3Configure Instance Details

Here we can keep everything default, no need to change any settings:

QQ20160515-6

 

 

3.4Add Storage

Here we can keep everything default, no need to change any settings:

QQ20160515-7

 

 

3.5Tag Instance

Here the Value we put will be the name of this instance, and it will be displayed on our AWS EC2 dashboard:

QQ20160515-8

 

 

3.6Configure Security Group

This step is very important!

Firstly, I want to talk about my failure experience:

According to my experience, normally if I start something new, default is most likely to be a good choice.

So for “Assign a security group”, I selected the “Select an existing security group” radio button, and chose the first security group listed, whose name is “default”. The following is the screenshot:

QQ20160515-9

And I just clicked the “Review and Launch” button.

Then I waited for a few minutes for the instance to be running. Sadly, because of the default group setting, I couldn’t SSH into the instance, which means I could do nothing about the instance. The instance was dead for me!

 

After checking some tutorials, I got to know that I have to create a new security group and add custom access rules. Here is the screenshot of the rules we need:
QQ20160517-0

 

4.Then we can see the running instance in EC2 dashboard

QQ20160517-1

QQ20160517-2

 

5.SSH into the instance

In command shell, cd to the directory that the private key is located. Then run this command:

$ ssh -i [private_key_file_name] ubuntu@[public_DNS_address]

For example:

QQ20160517-4

 

6.Run as root and access website folder

$ sudo su

$ cd /var/www/html/

 

 

 

 

 

 

 

 

 

 

Advertisements