How to Host a Website for Free Using AWS?

AWS provides a highly reliable, scalable, low-cost infrastructure platform in the cloud that powers hundreds of thousands of businesses in 190 countries around the world.

AWS offers 1-year free subscription with limited features of it. The 1year free tier service is available only for new customers. In this post, we will learn how to host a website using the basic feature of AWS.

Here is a link for how to create an AWS account & activate it. https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/

Step by Step Guides:

After activating the AWS account, follow these steps here are the steps by steps guides to host a website for free using AWS.

Step 01:

Step1 – Go to the AWS console page – https://aws.amazon.com/console/

Go to the AWS console page

Step 02:

Sign in to your root account with a login id & password.

Sign in to your root account with log in id & password

Step 03:

Here you can choose the region. Search EC2 in services then launch the instance.

Search EC2 in services then launch instance

Step 04:

  • You can choose server OS here, it’s called AMI(Amazon Machine Image).
  • Check the free tier option. I have chosen Ubuntu 16.04.You can choose server OS here, it’s called AMI(Amazon Machine Image).

Step 05:

  • Choose the instance type. T2 micro (1vcpu, 2.5 GHz, 1gib memory) comes with free tier eligibility.Choose an instance type. T2 micro (1vcpu, 2.5 GHz, 1gib memory) comes with free tier eligibility.
  • Go to configure instances details.

Step 06:

Click on the additional storage.

Click on the add storage

Step 07:

AWS provides free SSD storage space from 8 GB to 30 GB. Here you can uncheck the delete on termination option.

Here you can uncheck the delete on termination option

  • Click on the add tag option.

Step 08:

It helps you to manage your instances, images, and other Amazon EC2 resources. Tags enable you to categorize your AWS resources.

Click on the Configure security group

 

  • Click on the Configure security group.

Step 09:

  • Create a new security group.
  • Add Rule such as “ssh”, “Http”, “https”, “MySQL”.

If you want to access your website from anywhere then you can choose the option anywhere under the source option.

Add Rule such as “ssh”, “http”, “https”, “mysql”.

Step 10:

Review and lunch the instance.

Review and lunch the instance

Step 11:

View your instance.

View your instance

Step 12:

AWS gives a static IP for free.

  • Go to the Elastic IPs then click on the Allocate new address.AWS gives a static IP for free. Go to the Elastic IPs then click on the Allocate new address.

Step 13:

Here is your static /elastic IP.

  • Just Close it.static /Elastic ip

Step 14:

  • You have to attach the Static IP/Elastic IP to your instance.
  • Go to the Elastic IP option
  • Click on the Associate address under the “Action” dropdown box.Static ip/Elastic ip to your instance

Step 15:

  • Choose your instance from your instance ID
  • Then click on the associate.Choose your instance from your instance ID

Step 16:

  • Associate address request succeeded
  • Then close it.Associate address request succeeded

Step 17:

Amazon RDS is a managed relational database service that provides you six familiar database engines to choose from, including Amazon Aurora, MySQL, MariaDB, Oracle, Microsoft SQL Server, and PostgreSQL.

  • You can find AWS RDS to find services.
  • Then click on the create database.managed relational database service

Step 18:

  • Choose a database creation method.

I have chosen the MySQL database engine.

Choose a database creation method

Step 19:

  • Check the free tier then you can choose the MySQL version.

I have chosen MySQL 5.6.

choose mysql version

 

Step 20:

Give your credentials just

  1. Instance identifier
  2. Master User Name
  3. Master PasswordGive your credentials

 

Step 21:

AWS provides 20 GB storage space for RDS under the free tier.

AWS provides 20 gb storage space for RDS under free tier

Step 22:

  • Check yes in public access under additional connectivity configuration. So that you can access it from anywhere.
  • Choose an existing vpc security group. I have chosen the (lunch-wizard-1) security group because it is the attached security group of Ec2 instance.
  • You can choose the availability zone.security group of Ec2 instance

Step 23:

  • In the additional configuration, you can create a database & name it.
  • You can choose the DB parameter group.
  • Do not check Enable automatic backups, because it’s not coming under free tier services.In additional configuration, you can create a database & name it

Step 24:

  • Check the Enable deletion protection. It protects the database from being deleted accidentally.
  • Click on the Create database option.Click on the Create database option

Step 25:

After successfully created a database user, you can review your credentials.

After successfully created database user, you can review your credentials

Step 26:

  • Connection details to your database user.
  • Save the credentials & close it.Connection details to your database user

Step 27:

Puttygen part of the open-source network networking client PuTTY is a crucial generating tool to create public and private SSH keys for servers. https://www.puttygen.com/download-putty

The tool is used for SSH connectivity. So users can use PuTTY to connect and securely transfer data from localhost to remote system. puttygen helps to create a PPK file from pem file.

  • Click on the generate.putty key generator

After click on the generates option, you have to circulate the mouse randomly.

Step 28:

  • Click on the load.
  • Locate the pem file from your computer.
  • Choose the pem file, then save the private key as .ppk.putty key generator

Step 29:

  • Connect to SSH through putty. ( https://www.putty.org/)
  • Enter your Elastic/static IP in the Hostname.Connect to SSH through putty

Step 30:

  • Click on the SSH/Auth & browse the PPK file from your system.
  • After that Just Save it.Click on the SSH/Auth & browse the ppk file from your system

Step 31:

Install Apache2 web server

  1. sudo apt-get update
  2. sudo apt-get install apache2

Install PHP 7.2

  1. sudo add-apt-repository ppa:ondrej/PHP
  2. sudo apt-get update
  3. sudo apt-get install php7.2
  4. sudo apt-get install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-intl php7.2-mysql php7.2-xml php7.2-zip

Enable headers & rewrite for the apache2 webserver.

  1. sudo a2enmod headers
  2. sudo service apache2 restart
  3. sudo a2enmod rewrite
  4. sudo service apache2 restart

Install MySQL 5.6 client

  1. sudo add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu trusty universe
  2. sudo apt-get update
  3. sudo apt install mysql-client-5.6

Enable Allowoverride For Apache2 web server

  1. sudo nano /etc/apache2/apache2.conf
  2. Change AllowOverride None to AllowOverride All

Step 32:

Open the browser & type the server URL/IP

Open the browser & type the server URL/IP

Thank you.

Leave a Comment