Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 16:Two instances with Application load Balancer with own VPC

                            Lab 16:Two instances with Application load Balancer with own VPC

Refer above how to create our own vpc

First create security group for alb and webservers

Alb –http-80-anywhere

Webserver  -ssh –2-anywhere

http -80-custom-alb security group

first create group for alb webserver

go to EC2 dashboard

click on security group

create security group

 

Create webserver security group

 

Now create a alb load balancer

Go to EC2 dashboard

Create a load balancer

 


Select alb load balancer

Give a name to load balancer



 Scroll down select  your own vpc

Select availability zones and select public subnets in two zones.

Refer above as we create 2 public subnets and private subnets

 

Next click on configure security settings

 

Click on configure security setting

Select existing Security group as we create for alb security group

 

Then click on configure routing

Give a name to target group and give a path index.html

It will check for the index.html file

 

Next click on Register Targets

We will add the target after creating the instances

Just click on next

 

Click on Review

 

Click on Create

 

Alb created

Now create the instance now

Go to the Ec2 dashboard and launch the instances

 

Select the amazon ami

Go with default instance type

 


Click on configure instance

Select no.of instance two as the webservers having same type security group and all

Select your own Vpc

 


Next click on add storage

 

Go with the default storage

Click on tags

 


Next click on security group

 Select existing group which we created above (web server)

 

Click on review and launch

 

Click on launch

Select the key pair

 

Click on launch

 


Now  go to git bash and install the apache

Login to webserver

#ssh –I pemfile ec2-user@ipaddress

Ip address of webserver1

 

 

Now install apache

And start the service

 

Start the service

 

Now check whether the page is there or not

#curlhttp://localhost


If don’t want to see page like that just do the below command

Echo”this is webserver 1”>>/var/www/html/index.html

 

Do the same for the webserver2

Login to the server and install apache

 

Start the service

#systemctlstart httpd

 

Change the page

Echo”this is webserver2>>/var/www/html/index.html

 


Now check the page in browser

Go to load balancer

Select the alb load balancer and the webserver

 


Add the webserver and registered

 

And Save

Now take the alb end point and check the page browser




 


We have both pages

Comments

Popular posts from this blog

Lab 21:Installing docker in instance and build an image

Lab 22:Pushing a docker image to docker hub

Lab 5: Installing Nginx in EC2 instance