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/
Step 02:
Sign in to your root account with a login id & password.
Step 03:
Here you can choose the region. Search EC2 in services then launch the 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.
Step 05:
- Choose the 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.
Step 07:
AWS provides free SSD storage space from 8 GB to 30 GB. 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.
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.
Step 10:
Review and lunch the instance.
Step 11:
View your instance.
Step 12:
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.
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.
Step 15:
- Choose your instance from your instance ID
- Then click on the associate.
Step 16:
- Associate address request succeeded
- Then close it.
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.
Step 18:
- Choose a database creation method.
I have chosen the MySQL database engine.
Step 19:
- Check the free tier then you can choose the MySQL version.
I have chosen MySQL 5.6.
Step 20:
Give your credentials just
- Instance identifier
- Master User Name
- Master Password
Step 21:
AWS provides 20 GB storage space for RDS under the 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.
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.
Step 24:
- Check the Enable deletion protection. It protects the database from being deleted accidentally.
- Click on the Create database option.
Step 25:
After successfully created a database user, you can review your credentials.
Step 26:
- Connection details to your database user.
- Save the credentials & close it.
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.
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.
Step 29:
- Connect to SSH through putty. ( https://www.putty.org/)
- Enter your Elastic/static IP in the Hostname.
Step 30:
- Click on the SSH/Auth & browse the PPK file from your system.
- After that Just Save it.
Step 31:
Install Apache2 web server
- sudo apt-get update
- sudo apt-get install apache2
Install PHP 7.2
- sudo add-apt-repository ppa:ondrej/PHP
- sudo apt-get update
- sudo apt-get install php7.2
- 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.
- sudo a2enmod headers
- sudo service apache2 restart
- sudo a2enmod rewrite
- sudo service apache2 restart
Install MySQL 5.6 client
- sudo add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu trusty universe‘
- sudo apt-get update
- sudo apt install mysql-client-5.6
Enable Allowoverride For Apache2 web server
- sudo nano /etc/apache2/apache2.conf
- Change AllowOverride None to AllowOverride All
Step 32:
Open the browser & type the server URL/IP
Thank you.