Load Balncer and Auto scalling
Now time to create Roles
Now time to create Roles
IAM ---- Roles--- create a role should be use by EC2 --- PERMISION ----s3 full access---->Name:vprofile-artifact-storage-role--->create role.
IAM ---- Roles--- create a role should be use by EC2 --- PERMISION ----s3 full access---->Name:vprofile-artifact-storage-role--->create role.
Go ec2 instance ----->action----->settings ------> modify IAM roles -------> select our role-----> save this
Go ec2 instance ----->action----->settings ------> modify IAM roles -------> select our role-----> save this
Now our application server app01 is authentication to access s3 bucket and ready to use that roles.
Now our application server app01 is authentication to access s3 bucket and ready to use that roles.
Time to use app01.
Time to use app01.
Now we gonna add ssh to Ec2 instance on app01------>Go to backend security group
Now we gonna add ssh to Ec2 instance on app01------>Go to backend security group
inbound ----> edit
inbound ----> edit
Inbound rules:
Inbound rules:
Type: ssh----------->port:22-------->Source:myIP Choose its own IP address.------>save .
Type: ssh----------->port:22-------->Source:myIP Choose its own IP address.------>save .
Copy public ip for app01
Copy public ip for app01
we download the pem key and find where its located
we download the pem key and find where its located
Go to git bash ----->Try the below comments
Go to git bash ----->Try the below comments
ssh -i <where you download the key> <keyname>centos@<public ip>
ssh -i <where you download the key> <keyname>centos@<public ip>
ssh -i desktop/vprofile-prod-key.pem centos@ipaddress.
ssh -i desktop/vprofile-prod-key.pem centos@ipaddress.
log in---------->Then change into root ------>if you want to see user data from gitbash then try curl command
log in---------->Then change into root ------>if you want to see user data from gitbash then try curl command
curl http://169.254.169.254/latest/user-data
curl http://169.254.169.254/latest/user-data
Check our system is up and running.------->Systemctl status tomcat8
Check our system is up and running.------->Systemctl status tomcat8
Tomcat 8 is running
Tomcat 8 is running
Lets go to var/lib/tomcat8 ------> here we can see webapp directory-----> we will delete ROOT directory which will have default application.
Lets go to var/lib/tomcat8 ------> here we can see webapp directory-----> we will delete ROOT directory which will have default application.
before start this we need to stop Tomcat8 rm -rf ROOT
before start this we need to stop Tomcat8 rm -rf ROOT
Download Artifact from s3 bucket for that we need top install aws cli here
Download Artifact from s3 bucket for that we need top install aws cli here
apt install awscli -y---->we gonnan use ----------->aws s3 ls s3://vprofile-artifact-storage
apt install awscli -y---->we gonnan use ----------->aws s3 ls s3://vprofile-artifact-storage
aws s3 cp s3://vprofile-artifact-storage/vprofile-v2.war/tmp/vprofile-v2.war
aws s3 cp s3://vprofile-artifact-storage/vprofile-v2.war/tmp/vprofile-v2.war
cd /tmp/----------->cp vprofile-v2.war /var/lib/tomcat8/webapps/ROOT.var------>start tomcat 8 ------->systemctl start tomcat8---------->
cd /tmp/----------->cp vprofile-v2.war /var/lib/tomcat8/webapps/ROOT.var------>start tomcat 8 ------->systemctl start tomcat8---------->
ls var/lib/tomcat8/webapps/------>cd var/lib/tomcat8/webapps/ROOT--------->ls--------->cd WEB-INF---------->ls------->cd classes----->ls ------------>where we have application property
ls var/lib/tomcat8/webapps/------>cd var/lib/tomcat8/webapps/ROOT--------->ls--------->cd WEB-INF---------->ls------->cd classes----->ls ------------>where we have application property
Now let check our servers are connected by using telnet db01.vprofile.in 3306
Now let check our servers are connected by using telnet db01.vprofile.in 3306
LOAD BALANCER AND DNS
LOAD BALANCER AND DNS
All our server is working fine now we need to install Load balancer and need to create Target group
All our server is working fine now we need to install Load balancer and need to create Target group
Load balance
Load balance
First create target group --- >instances---->Name: vpofile-app-TG---->protocol --->HTTP------>port:8080 ------------>same VPC-------> Health check:/login -------->For health check over write the port 8080 available instance server tomcat.--------->create target group
First create target group --- >instances---->Name: vpofile-app-TG---->protocol --->HTTP------>port:8080 ------------>same VPC-------> Health check:/login -------->For health check over write the port 8080 available instance server tomcat.--------->create target group
Go to load balancer
Go to load balancer
application load balancer
application load balancer
crete http amd https---->Name: vprofile-prod-elb----->internet facing------>ptotocol HTTP 80---------->protocolo:HTTPS 443------>Select all the zone ----->click next ---------->certificate for HTTPS(we already got the certificate from DNS select that certificate)-------->Security group Load Balancer Vprofile-ELB-SG
crete http amd https---->Name: vprofile-prod-elb----->internet facing------>ptotocol HTTP 80---------->protocolo:HTTPS 443------>Select all the zone ----->click next ---------->certificate for HTTPS(we already got the certificate from DNS select that certificate)-------->Security group Load Balancer Vprofile-ELB-SG
ROUTE THE REQUEST FROM TARGET GROUP
ROUTE THE REQUEST FROM TARGET GROUP
Name: vprofile-app-TG--->protocol: HTTP---->PORT :8080------>Health check---------->PROTOCOL:HTTPS-------->PATH:/login
Name: vprofile-app-TG--->protocol: HTTP---->PORT :8080------>Health check---------->PROTOCOL:HTTPS-------->PATH:/login
--------->Click register target will take end point to the load balancer
--------->Click register target will take end point to the load balancer
Go to our domain provider
Go to our domain provider
Click add DNS Record typr--> CNAME host---> vprofileapp point to --->paste the endpoin of the load balncer.----->save this.
Click add DNS Record typr--> CNAME host---> vprofileapp point to --->paste the endpoin of the load balncer.----->save this.
Go to web browser
Go to web browser
Auto scaling
Auto scaling
EC2 -->Action-->Image---->Create Image
EC2 -->Action-->Image---->Create Image
Create Image
Create Image
Image Name: vprofile app ----->Describtion: crete image ---------->click create image.
Image Name: vprofile app ----->Describtion: crete image ---------->click create image.
Launch configuration
Launch configuration
Left side you have create launch configuration.---------->create launch configuration----> name: vprofile-app-LC
Left side you have create launch configuration.---------->create launch configuration----> name: vprofile-app-LC
Select IAM---> Select from the Link------> T2.micreo
Select IAM---> Select from the Link------> T2.micreo
Role: we already created iam roles choose that. -------------> security: vprofile-app security group --------------->create launch configuration.
Role: we already created iam roles choose that. -------------> security: vprofile-app security group --------------->create launch configuration.
Auto scaling group
Auto scaling group
crete autoscaling--- name:vprofile-app-ASG ------------>Select launch configration--------> Same Vpc------>Select all zone--------> Enable load balancer select our target group and check health check on the load balancer-----> We can decide the capacity ------> Scaling policy----> Tracking scaling policy----> Target value for Cpu 50%---->Next---> add notification-----> next----> Tags name: vprofile-app ---------->Create auto scaling group.
crete autoscaling--- name:vprofile-app-ASG ------------>Select launch configration--------> Same Vpc------>Select all zone--------> Enable load balancer select our target group and check health check on the load balancer-----> We can decide the capacity ------> Scaling policy----> Tracking scaling policy----> Target value for Cpu 50%---->Next---> add notification-----> next----> Tags name: vprofile-app ---------->Create auto scaling group.
OUR AWS CLOUD COMPUTING PROJECT IS SUCCESSFULLY DONE! AND ITS UP AND RUNNING .
OUR AWS CLOUD COMPUTING PROJECT IS SUCCESSFULLY DONE! AND ITS UP AND RUNNING .