Friday, April 23, 2021

phpMyPassion

How To Host A Website On AWS using Elastic Load Balancers (ELB)?

I found most developers struggling to host a website on AWS. Even some of my friends ask me several time to make them understand some easiest way to host a website on AWS. Also many of developers are fears to host their websites on AWS due to high charges associated on AWS. But you have all the control on AWS. So you can minimise the charges as you wants.

I have already describe a simplest process for hosting a website on AWS using vista panel. you can check Easy Process to Host website on AWS..

So guys here I am gonna explain one more easy process to host a website on AWS cloud via Elastic Load Balancers (ELB) and it will even charge you less then other hosting service provided by godaddy, hostgator etc.

Step 1:- Login to your AWS console.

First of all you have to login into you AWS account. if you are new user then you have to create a new AWS account by clicking on the button showing in below screenshot.
You will get free tier access for 12 months if you are new user. So you will not get any charges till 12 months on AWS if you use free services.


Step-2:- Create A ec2 instance.

You have to create a ec2 instance first using ubuntu 16.04 AMI on AWS marketplace.(Also you have to download PEM file in the last step). PEM file will help you to login via terminal through SSH.

Ensure all ports like 80, 8080,8083,22,143 etc are enabled in your security croup.

Step-3:- Install required software to server.

Now you have to login via ssh or pem file to server through terminal. you can use below example command for SSH..

sudo ssh -i /home/user/Desktop/pemfile/xyz.pem ubuntu@00.00.00.0

Install softwares like xampp, wamp, nginx, mysql etc required for your website. below are some sample command for installing nginx on ubuntu.

    • sudo apt-get update
    • sudo apt-get install nginx

Step-4:- Upload your files via FTP or Terminal via command.

Now you have to upload your project files into server. you can upload it either FTP or via terminal. for uploading via terminal you can use below command..
  • scp -i /home/user/Desktop/pemfile/xyz.pem -r /home/user/Desktop/your_website_folder/ ubuntu@94.195.170.104:/home/root/www/

and for uploading files using FTP, you can go check my one of post for connecting aws server via FTP How to Connect AWS EC2 Server With SFTP

Step-5:- Go to Load Balancers and Create a Load Balancer

Now you have to create a elastic load balancer for your application. Load balancers are use for balancing load on your website. so create a application load balancer as shown below image.

  


Step-6:- Create a Target Group.

Now you have to create a target group under Load Balancing -> Target Groups submenu. Here you have to register your already created aws instance as shown in below image. you can register more than one instances associated with your web application and then you have attach this Target Group with your Load Balancer.


You have to add your instance into Target Tab as shown in above picture.

Step-7:- Now Register your Load Balancer ARN with your Domain in AWS Route53.

Now you have to assign your created load balancer with your domain in AWS Route53. As you assign the load balancer with your domain, go to browser and visit your website. you will find your website in working condition on browser.
AWS route53 will look like below image..



I hope this process will help you to host a website using AWS ELB. If you found any type of difficulty, you can simply comment here. I will try to resolve your issue. Thank you.



About Author -

Hi, I am Anil.

Welcome to my eponymous blog! I am passionate about web programming. Here you will find a huge information on web development, web design, PHP, Python, Digital Marketing and Latest technology.

Subscribe to this Blog via Email :

Note: Only a member of this blog may post a comment.