Name it instead "topics" so it won't be strange if some topics included "exercises" directory.
2.0 KiB
AWS ELB - ALB Multiple Target Groups
Requirements
Two EC2 instances with a simple web application that shows the web page with the string "Hey, it's a me, <HOSTNAME>
!"
One EC2 instance with a simple web application that shows the web page with the string "Hey, it's only a test..." under the endpoint /test
Objectives
- Create an application load balancer for the two instances you have, with the following properties
- healthy threshold: 3
- unhealthy threshold: 3
- interval: 10 seconds
- Create another target group for the third instance
- Traffic should be forwarded to this group based on the "/test" path
Solution
Console
-
Go to EC2 service
-
Click in the left side menu on "Load balancers" under "Load balancing"
-
Click on "Create load balancer"
-
Choose "Application Load Balancer"
-
Insert a name for the LB
-
Choose an AZ where you want the LB to operate
-
Choose a security group
-
Under "Listeners and routing" click on "Create target group" and choose "Instances"
-
Provide a name for the target group
-
Set healthy threshold to 3
-
Set unhealthy threshold to 3
-
Set interval to 10 seconds
-
Click on "Next" and choose two out of three instances you've created
-
Click on "Create target group"
-
Refresh target groups and choose the one you've just created
-
Click on "Create load balancer" and wait for it to be provisioned
-
In the left side menu click on "Target Groups" under "Load Balancing"
-
Click on "Create target group"
-
Set it with the same properties as previous target group but this time, add the third instance that you didn't include in the previous target group
-
Go back to your ALB and under "Listeners" click on "Edit rules" under your current listener
-
Add a rule where if the path is "/test" then traffic should be forwarded to the second target group you've created
-
Click on "Save"
-
Test it by going to the browser, insert the address and add "/test" to the address