- terraform init
- terraform plan
- terraform apply -auto -approve
Create vpc with (2 private, 2 public ) subnets in different availability zones,2 Nat gateway in a different availability zone, one internet gateway
go to the auto-scaling group
create auto-scaling group
create launch template
select os
select instance type
create a security group in the created vpc and select it in the launch template
select launch template
in instance, launch options select vpc and private subnets and zones
in the advanced option select an application load balancer – internet-facing
in group size desired capacity 1 scaling limit 1 max desired capacity 1 no scaling
policy, no instance maintenance policy
review the configuration and create auto scaling group
create 2 instances as a bastion host
connect the private IP host and deploy the webserver
register the private subnet instance in the load balancer
copy dns name and test for replay from both web server
sudo –I
- apt-get update
- nano x #x = any name to a file
- #paste the ssh key in this file
- #then press ctrl+o
- #enter
- #ctrl+x
- #paste the ssh key in this file
- ls #for checking the file created is there
- chmod x 400 #to give read-only permission
- ssh –I prac-account-ssh ubantu@xxxx.xxxx.xxxx.xxxx
- yes # After connection established
- sudo –I
- apt-get update
- apt install nginx
- y
- service nginx status
- echo “hello from $(hostname)” > /var/www/html/index.html
- curl localhost