...

/

Load Balancing: Add a second EC2 Instance

Load Balancing: Add a second EC2 Instance

We'll cover the following...

Objective

  • Run our application on more than one EC2 instance.

Steps

  • Add a second EC2 instance.

Currently, our application is running on a single EC2 instance. To allow our application to scale beyond the capacity of a single instance, we need to introduce a load balancer that can direct traffic to multiple instances.

Adding a second instance

We could naively add a second instance by simply duplicating the configuration we have for our existing instance. But that would create a lot of configuration duplication. Instead, we’re going to pull the bulk of the EC2 configuration into an EC2 launch template, and then we’ll simply reference the launch template from both instances.

We can almost copy our EC2 instance configuration into a new launch template resource as is, but there are slight differences between the two ...