How to run you first website on Amazon AWS?

Today, is the time of cloud computing and many of us might not be aware of how to set up your first website on one of the best and popular cloud service providers i.e. Amazon Web Services or AWS. So, I am here to explain or guide you in setting up your first web environment on AWS. Before we begin we have to make sure that we have a valid AWS account. You should be aware that Amazon offers free web hosting services for 1 year (with certain limitations ofcourse). So, if you are going for the first time, please create your AWS account now, don’t worry to put up your credit or debit card details on amazon aws just make sure you don’t go for their paid services within their 1 year free plan or else you will end up paying for every service you use (ofcourse which are not free but paid).

Steps to set up you AWS based website.

1. Create you Amazon Web Services or AWS account.


2. Visit EC2 management console page

Example link: (region may be different or this url may vary)

3. Launch or Create an EC2 instance (do not indulge in depth just follow the basics while configurations).

4. Please go with the flow if you’re opting for 1 year free service. In this case I’m selecting Ubuntu as operating system and all the rest configurations as suggested by amazon for free.

4. At the time of creating your EC2 instance you will be asked to provide key pair values or regenerate new key pair values. Please regenerate a key pair value and save it very securely. Please note that loosing this key will result in loosing the link for connecting to your instance or your server where your files are present. So, please make sure you save it very securely.

5. Once you’re done in saving your keys and launching your EC2 instance. Its time to create an elastic ip, pleae create an elastic ip and associate it with your EC2 instance.

Example Link:

6. Now, its time to install & configure your server and required environment.

When you are on Windows you need to download putty like application to log into SSH. SSH provides an interface to locate your operating system with the elastic ip address or dns server name (in case elastic ip is not available), the saved key pair values can be used to get into your system (present on cloud).

Please note that amazon gives a key file in .pem format you can generate a .ppk file using puttygen application. This .ppk file can used with a pass phrase to log into ssh using putty and .pem specific file can be used in filezilla to access server files using ftp.

Please use already defined user names in case of logging into ssh or filezilla. For instance if you have installed Ubuntu as operating system the default user name would be ubuntu.

7. I assume, you have performed all the above steps or required steps to gain access to SSH. Now, its time to install and configure your apache server environment. By default, if you have launched an EC2 instance your machine is completely new and blank with just an operating system. So, you have to install and configure all applications if you plan to use.

Steps to configure Apache Environment on Ubuntu:

Install Lamp Server:
Command: sudo apt-get install lamp-server^

Add new user apart from default one
Command: adduser {name}

Add current user to a group
Command: sudo groupadd www

Add required permissions to current user and the group
Command: sudo usermod -a -G www {current user name}

Exit from SSH
Command: exit

Clear Screen
Command: clear

Execute commands which cannot be executed as a normal use or needs admin access
Please use sudo as prefix to all commands. Please make sure you are using right command thereafter as using sudo as prefix will simply telling operating system that look I know and I want to run this command as root user, I know the outcomes and I am responsible for it. So, please execute it as root user. So using this command as prefix, one must be very understanding and knowledgeable for what is going to effect.

to check available groups
Command: groups

Granting access to group and folders/files for current logged user
Command: sudo chown -R {user }:www /var/www

Command: sudo chmod 2775 /var/www

find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;

Enable Apache URL rewriting
enable url rewriting (sudo a2enmod rewrite)

install ioncube loader
zend_extension = /usr/lib/php5/20121212/

Installing applications for LAMP
Command: install phpmyadmin

Command: install sendmail

Command: install curl

Installing zip applications
Command: install unzip

Remember to use sudo as prefix e.g. sudo install curl, if any command fails to execute and seeking root users right.

For AWS – Assign elastic IP and update security group. Remember to keep default security group

<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/html/>
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride all
Order allow,deny
allow from all

Hope, this information was useful to you. Please share your valuable findings and suggestions to improve this article or help tacking the unknown issues find while going for AWS configuration.



Yuvraj has written 39 articles

"Learn & Share" - I believe in this. What about you?