For past few months I was using Bitnami Webhosting stack to host wordpress blogs. I went for it because it was easy to install and configure. I also wanted to try it in the first place to get acquainted with Amazon Web Services without much hassle. However later on I felt that with Bitnami stack I am limiting the utilization of my EC2 instance.

Beside that I also felt that I don’t have major control on web server settings and sometimes the turnaround time of service is too much.

I felt it’s time to move on, use EC2 instance as a proper web server with multiple domains mapping to it.

This is a step-by-step guide to install WordPress and other simple websites in a single EC2 instance.

Lets start with setting up an Ubuntu 14.04 Amazon EC2 instance.

    1. Open https://aws.amazon.com/ in your browser and login with your credentials.

If you don’t have account with aws.amazon.com then sign up. You might require your credit card credentials while creating the account.

Note: They won’t charge you anything unless you buy a product or service; and as of now you are eligible of an EC2 t2.micro instance with Linux, Red hat or Windows OS and 750 hours of running time which is enough for a month.

aws10

    1. When you are logged in select your cloud zone where you want to set up your instance.

aws1

    1. Then click on the EC2 icon on top left hand side to open EC2 dashboard. You will land up in EC2 management console. From here you can create, configure, backup and delete your EC2 instances

aws2

    1. Click on “Launch Instance”. You will be redirected to AMI Quick start guide/wizard. Since we are going to use the free tier we will follow the wizard

aws3

    1. We will try “Ubuntu Server 14.04 LTS (HVM), SSD Volume Type” instance with Root device type: ebs & Virtualization type: hvm. Click on “Select”

aws4

    1. Select the free tier eligible instance type. Proceed with “Review and launch”
    2. Add a storage of 8GB. As of now proceed with whatever default security group and settings you are provided with EC2 instance and create the instance

aws5

aws6

    1. While launching the instance you will be asked to generate a key pair to login to system. This will ask you for a keypair name (you can give any name to the file). You will be asked to download the *.pem file. This file is very critical and SSH requires this file.

aws11

    1. Management console of a running instance will look like this. (Click on “Instances” if you are not redirected to this page after EC2 instance get created.)

aws7

    1. Check Instance Status “Running”.

      Congrats you have successfully set up your EC2 instance of Ubuntu.

    2. Last but not least i.e. how to connect EC2 instance. Click on the “Connect” button.

aws8

    1. You will get a pop up like this. It contain all the information about your public IP, *.pem file permission setting and SSH login command.
      ssh -i pem_filepath ubuntu@publicIP

You can refer to Connect to EC2 instance using SSH from terminal for more details.

aws9

    1. Now since we are using this instance as a web server we need to add a rule in “Security Groups” to allow HTTP and HTTPS access. Go to “Security Groups” tab, select Security Groups corresponding to your instance which is by default “launch-wizard-1″. Edit the rules such that it looks like following screenshot.

aws12

    1. If you want to have a public static IP of your instance and want to map a domain with it e.g. www.mydomain.com then you have to allocate an Elastic IP with your instance. The procedure is very simple but this will cost you something. I feel the price is very reasonable. Click on Elastic IPs. Click on “Allocate New Address” Click on “Associate Address” and associate it with your instance.

aws13

Congrats!! You are done!! By following the above command from putty or terminal you will be able to login to newly created ubuntu EC2 instance.

Next: Prepare Ubuntu EC2 Instance with LAMP web server