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 15: Two instances which classic load Balance with own VPC

                         Lab 15: Two instances which classic load Balance with own VPC

Go to ec2 dash board create the bastion instance

First create security group for instances and load balancer

Go to the security dashboard and create securities

Create security for bastion server

 

Click on create

Now create security for load balancer

End user will enter the web server with load balancer

 

Click on create

Now create security for web server

For admin login attach give bastion security group and for end user attach load balancer security group

 




Now create instances

Create instance for bastion

Go to ec2 dashboard

click on launch instance

Select amazon linux ami

 

Next choose an instance type

Go with free trail only

 


Next click on configure instance type

Now near network select your own vpc

Subnet select public-1sub net and auto assign ip should be enable

Rest of the things will leave all a default only

 

Next click on add storage

Go with default storage only

 

Next click on tags                 

 

Next click on security group

Select existing security group and select existing bastion sg as we are creating instance for bastion

 

Next click on review and launch

 

Click on launch: 

Create a new key pair and download the key pair

 


Click on launch

 


Now create instance for web server

Go to ec2 dashboard click on launch instance

Select amazon ami linux

 

Choose an instance type

Go with default one

 


Next click on configure instance details

Here select your own vpc and select private one subnet

 

Click on add storage

Go with default storage only


Add on tags

 

Click on security group

Select existing security group


 Click on Review and launch

 

Click on launch

Here select existing key pair

 

Launch instance

Now create another web server2 same as web server 1

Go to ec2 dash board launch instance

Select amazon ami

 

Select instance type

Go with the default one


click on configure instance

select your own vpc

Select private 2 subnets


Note :we are creating the instances the instances in two availability zone because if one zone goes down we have  another zone .This is called high availability.

Next click on add storage

 

Click on add tags

Click on security group

Select existing security group and select web server security group

 

Click on Review and launch

 

Click on launch

Select existing key pair

 

Click on launch instance

 

Now create a load balancer

Go to ec2 dash board

Select load balancer

 

Create load balancer

 

Go with the (Classic Load Balancer) CLB

 

Scroll down and select 2 public subnets

 

Then click on assign security group

Select load balancer security group

 

Click on next

 

Click on next

 

Click on add ec2 instances

Here add two webservers

 

Then add on add tag

 

Click on Review and create

 

Click on create

 

Load balancer is created

Now go to git bash

Login to bastion

First copy the key pair from Downloads  to Bastion

#scp –I pemfile pemfile ec2-user@ipaddress :/home/ec2-user

 

Now login bastion

#scp –I pemfile ec2-user@ipaddress

Switch to root user

And change the permission of a pemfile

#chmod 400 pemfile

 

Now login to webserver 1

And install apache

#ssh –I ownvpc ec2-user@ipaddress

Here ip address is webserver ip addresss

 

Now switch to root user and install the apache

#yum install httpd –y

 

Apache installed

Now start the service

#systemctl start httpd

 

Just run the command #ps-ef|grep httpd to know whether service started or not

Then run the curl http://localhost

To know whether page is there not

 

Page is there

Take webserver 1 ip address check the page in browser

I f you don’t want to get page like above just do the echo

#echo “this is webserver1”>>var/www/html/index.html

 

 

You will get a page like this

Now follow the same steps for webserver2

Got to the git bash

Login to bastion

#ssh –I pemfile ec2@user@ipaddress

Ip address webserver2 ip address

 

Logged in webserver2

Switch to root user and install

Now install the apache

#yum install httpd –y

 

Installed

Now start the service

#systemctl start httpd

 

Now do the curl to test the page

#curlhttp://localhost

 

Page is there

Now check the page from the browser by end point of load balancer




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