This possible demonstration outlines the steps involved in creating a Virtual Private Cloud (VPC), which may then be used to house servers in a setting that is focused on production.
A deployment method is used, in which servers are spread across two different Availability Zones, to improve operational robustness. An Auto Scaling group is used in conjunction with an Application Load Balancer to accomplish this distribution. By positioning the servers inside private subnets, a security safeguard is additionally put in place. The aforementioned load balancer is used to redirect requests made to the servers. A Network Address Translation (NAT) gateway is also used to connect the servers to the internet, and it is deployed in both of the selected availability zones to further increase system resilience.
Architecture :
Step 1 : Create the VPC
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.
1.1 - Configure the VPC
: Select VPC and more
: For Name tag auto-generation, enter a name for the VPC.
: For IPv4 CIDR block, you can keep the default suggestion, or alternatively you can enter the CIDR block required by your application or network.
1.2 - Configure the AZs, public and private subnets, NAT gateway and VPC endpoints as mentioned below
Step 2 : To launch instances by using an Auto Scaling group
2.1 - Create a launch template to specify the configuration information needed to launch your EC2 instances by using Amazon EC2 Auto Scaling.
Note : Use same key pair (login) for the entire project.
Refer Create a launch template for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
2.2 - Create an Auto Scaling group, which is a collection of EC2 instances with a minimum, maximum, and desired size.
Refer Create an Auto Scaling group using a launch template in the Amazon EC2 Auto Scaling User Guide.
2.3 - 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.
Step 3 : Create Bastion Host
A server called a "bastion host" is used to grant access to a private subnet from an external network, such the Internet, Public subnet. A bastion host must reduce the likelihood of infiltration because of its vulnerability to possible attack. To reduce the risk of enabling SSH connections from an external network to Linux instances created in a private subnet of your Amazon Virtual Private Cloud (VPC), for instance, you can use a bastion host.
Refer Configuring private network access using a Linux Bastion Host
Step 4 : Run the following commands in terminal
[1] scp -i localmachine/path_to_the_file username@server_ip:/path_to_remote_director
[2] ssh -i pemfile.pem ubuntu@public_ip_of_bastion
[3] ssh -i pemfile.pem ubuntu@public_ip_of_other_instance
[4] vim index.html
Note : Add html code for your webpage and save using :wq command
[5] python3 -m http.server 80
Step 5 : Create an Application Load Balancer
Refer Create application Load Balancers through the AWS Management Console
Note : Set target group at port 80 (http)
Step 6 : Copy DNS Name from load balancer created to a new tab to view your webpage.
Now, you can see your webpage successfully hosted !!
- Example: VPC with servers in private subnets and NAT
- Create a launch template for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
- Create an Auto Scaling group using a launch template
- Elastic Load Balancing User Guide and Use Elastic Load Balancing in the Amazon EC2 Auto Scaling User Guide.
- Configuring private network access using a Linux Bastion Host
- Create application Load Balancers through the AWS Management Console




