In this example we are going to show how to implement a load balancer using AWS.
Through this configuration we will be able to horizontally scale the application servers and thus increase performance, reduce latency and provide tolerance to failure.
In this example we will see a load balancer with two different subnets in which our instances are hosted, this entry is a series of several. In the next posts we will see how to improve this balancer.
Network diagram:
Network settings:
| VPC | |
|---|---|
| Name tag: | RedOrbita VPC |
| IPv4 CIDR block: | 10.200.0.0/20 |
| Subnet | |
|---|---|
| Name tag: | Public Subnet 1 |
| IPv4 CIDR block: | 10.200.0.0/24 |
| Name tag: | Public Subnet 2 |
| IPv4 CIDR block: | 10.200.1.0/24 |
| Route Table | |
|---|---|
| Destination: | 0.0.0.0/0 |
| Target: | Internet Gateway |
We begin with the deployment of the infrastructure
We create the VPC:
To deploy a new server we have to go to Service > VPC > Your VPCs > Create VPC
We create the two public subnets: Services > VPC > Subnets > Create Subnet
We generate the Internet Gatewa: Services > VPC > Internet Gateway > Create Internet Gateway
We attach the Internet Gateway to the VPC. We select the Internet Gateway created > Actions > Attach VPC
We select the VPC created previously.
We configure the Security Group with the corresponding permissions: Service > VPC > Security Group > Create Security Group and once created at the bottom we create the corresponding rules
We create the route table: Service > VPC > Route Tables > Create Route Tables. once created we will Routes and we configure the necessary routes:
We create the ROLE: Service > IAM > Role > Create Role > We select EC2 
Following
We generate two instances in different areas, in order not to lengthen this tutorial I am not going to show how to deploy an instance, for this you can see it in the following link:
Once the two instances have been generated in the different subnets we are going to create the load balancer, to do this we are going to:
Services > EC2 > Load Balancers > Create Load Balancer
We select the option Application Load balancer (In the case that we want to perform a layer 7 balancing)
We assign a name, protocol by which load balancing will be carried out (in my case only on port 80) and we select the two subnets created previously
Following…
We configure the Security Group
Here we can configure the load balancing status check, in my case I leave it by default.
We select the instances and click: Add to registered
It shows us a brief summary of the configuration made. Create!
Once the balancer is created, we copy the DNS name of the balancer and access the same URL several times. If everything went correctly it should balance the different instances.
:wq!



















Comments