Load balancing
To have an application accessible from the internet you need a load balancer that can route traffic to the application.
The load balancer set up for your environment is {Environment}-public
.
Step 1: Add and configure the load-balancing
package
ok pkg add load-balancing-alb load-balancing-alb-main
cd load-balancing-alb-main
We chose main
here because we have just one load balancer. If you have multiple load balancers, you can replace
main
with something more descriptive (for instance "payments", "catalog", "orders").
Update package-config.yml
with your preferences. The Name
field should be main
(or whatever you chose above) to
avoid confusion:
Step 2: Install the package
Step 3: Initialize and apply the load-balancing
stacks
ALB are separated into two stacks when creating them.
The first stack is the data stack, which contains data-related resources, this must be applied first.
The second stack is the alb stack, which contains the load balancing set up, route53, etc.
Step 4: Verify
Run the following command:
The output list should contain the name of the load balancer you just created.
Login to the AWS console and navigate to EC2. Select Load Balancers in the left-hand menu.
The list should contain the name of the load balancer you just created.
Next step
Set up IAM.