Setting up the application load balancer
Before setting up the application load balancer, we need to consider a few points:
- First, we need to decide on two AZs that we will use for our EC2 instance. Generally, we use a public subnet in each AZ and for this example, we are going to use
us-west-2a
(subnet10.0.1.0/24
) andus-west-2b
(subnet10.0.2.0/24
). The reason we are using two subnets is to provide high availability, and we already discussed this in Chapter 3, Creating a Data Center in the Cloud Using VPC. - Now we have decided that we will use two instances. In the next step, we need to install a web server (for example, Apache) on each instance. We already saw, in Chapter 4, Scalable Compute Capacity in the Cloud via EC2, as a part of EC2 instance installation, how to use user data to install a web server. To install the second server in different AZs, we will use a Terraform script that will take care of the following step, install Apache RPM, start the Apache service...