#Overview
This project demonstrates how to create a VPC that you can use for servers in a production environment. To improve resiliency, you deploy the servers in two Availability Zones, by using an Auto Scaling group and an Application Load Balancer. For additional security, you deploy the servers in private subnets. The servers receive requests through the load balancer. The servers can connect to the internet by using a NAT gateway. To improve resiliency, you deploy the NAT gateway in both Availability Zones.
The following diagram provides an overview of the resources included in this example. The VPC has public subnets and private subnets in two Availability Zones. Each public subnet contains a NAT gateway and a load balancer node. The servers run in the private subnets, are launched and terminated by using an Auto Scaling group, and receive traffic from the load balancer. The servers can connect to the internet by using the NAT gateway. The servers can connect to Amazon S3 by using a gateway VPC endpoint
Use the following procedure to create a VPC with a public subnet and a private subnet in two Availability Zones, and a NAT gateway in each Availability Zone. use documentation
Create a launch template to specify the configuration information needed to launch your EC2 instances by using Amazon EC2 Auto Scaling. For step-by-step directions, see Create a launch template for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.use documentation
-
Auto-assign public IP: Change whether your network interface with a device index of 0 receives a public IPv4 address. By default, instances in a default subnet receive a public IPv4 address, while instances in a nondefault subnet do not. Select --Disable-- to override the subnet's default setting.
-
For Launch template, choose an existing launch template(that we have created above).
-
On the Choose instance launch options page, under Network, for VPC, choose a VPC(that we have created above). The Auto Scaling group must be created in the same VPC as the security group you specified in your launch template.
-
For Availability Zones and subnets, choose only private subnets.
-
On the Configure group size and scaling policies page, configure the following options, and then choose Next:
-
For Desired capacity, select 2, for minimum capacity select 1, for maximum capacity select 4.use documentation
Create a load balancer, which distributes traffic evenly across the instances in your Auto Scaling group, and attach the load balancer to your Auto Scaling group. For more information, see the Elastic Load Balancing User Guide and Use Elastic Load Balancing in the Amazon EC2 Auto Scaling User Guide.use documentation
Target groups route requests to one or more registered targets, such as EC2 instances, using the protocol and port number that you specify.use documentation
A bastion host is a server whose purpose is to provide access to a private network from an external network, such as the Internet.use documentation
- Copy the public ip adress of bostion host.
- use scp -i ubuntu@:/home/ubuntu
- open local terminal use shh and keypair to connect.
- once connection is successfull
- copy the private ip address of one ec2 instance
- use ssh -i file.pem ubuntu@
- create a html page vim index.html
- run it python3 -m http.server:8000
- Goto the load balancer
- copy the dns name and browse it, tada.... we have successfully launch a web page in production lelvel.