Creating VPC, deploying the app in a private subnet, and receiving requests from Load Balancer. [Project1] | Day 7

Introduction

In the journey of learning AWS for 30 days, we have learned about VPC and various security-related things. On day 6, we know about the VPC and route 53 theoretically. Link to day 6 here. Here today we practically implemented the best VPC practice.

About the Project

Here this example demonstrates how to create a VPC that we can use for a server in a production environment.

✅We will Create VPC containing two private and public subnets each on a different availability zone

✅We create an auto-scaling group for the private subnet to create EC2 instances.

✅We create Bastion Server to ssh into the private subnet

✅We logged into one private subnet and install the Python app and exposes it on the 8000 port.

✅We create a load balancer to balance the traffic between the subnets and for receiving the request from the internet.

Project

At first, we create VPC with 1 private subnet and 1 public subnet in one availability zone and the same in another availability zone.

Once we create VPC we then proceed to create auto-scaling groups configuring the required field.

Using AutoScaling we can easily increase our instances that we will help in effectively managing the request.

We create 2 EC2 instances in a private subnet where we are going to deploy the app.

Now we again create the instance for Bastion Host that will help us to provide access to a private network from an external network, such as the Internet.

After the creation of the Bastion Host, we ssh to that server through our local key pair.

For accessing the private subnet we first need to copy that key pair file from our local device to the Bastion Host Server and from that, we can ssh into the Private Subnet.

We logged into the Private Subnet EC2 instance and install the simple Python app and expose the app. We only install the app in one of the private instances.

Now, at last, we create the load balancer which is used in receiving the request and balancing the load between the servers although we only install our app in one private instance.

We create a target group and create a load balancer

Using the load balancer we access our app which is on a private subnet.

In this way, we access our app install in a private subnet using a load balancer following the VPC best practices.

Conclusion

In this way, we access our app install in a private subnet using a load balancer following the VPC best practices. We learned to create the Auto Scaling groups, Use Bastion Host to connect the private subnet and create a load balancer. Very Special Thanks to Abhishek Veeramalla For the Course on AWS.