This topic describes how to attach a VPC Lattice target group to an Auto Scaling group. It also describes how to turn on VPC Lattice health checks to let Amazon EC2 Auto Scaling replace instances that VPC Lattice reports as unhealthy.
By default, Amazon EC2 Auto Scaling only replaces instances that are unhealthy or unreachable based on Amazon EC2 health checks. If you turn on VPC Lattice health checks, Amazon EC2 Auto Scaling can replace a running instance if any of the VPC Lattice target groups you attach to the Auto Scaling group report it as unhealthy. For more information, see Health checks for instances in an Auto Scaling group.
Important
Before you continue, complete all prerequisites in the previous section.
Attach a VPC Lattice target
group
You can attach one or more target groups to an Auto Scaling group when you create or update the group.
Follow the steps in this section to use the console to:
-
Attach a VPC Lattice target group to an Auto Scaling group
-
Turn on the health checks for VPC Lattice
To attach a VPC Lattice target group to a new Auto Scaling group
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
On the navigation bar at the top of the screen, choose the AWS Region that you created your target group in.
-
Choose Create Auto Scaling group.
-
In steps 1 and 2, choose your desired options and proceed to Step 3: Configure advanced options.
-
For VPC Lattice integration options, choose Attach to VPC Lattice service.
-
Under Choose VPC Lattice target group, choose your target group.
-
(Optional) For Health checks, Additional health check types, select Turn on VPC Lattice health checks.
-
(Optional) For Health check grace period, enter the amount of time, in seconds. This amount of time is how long Amazon EC2 Auto Scaling needs to wait before checking the health status of an instance after it enters the
InService
state. For more information, see Set the health check grace period for an Auto Scaling group. -
Proceed to create the Auto Scaling group. Your instances will be automatically registered to the VPC Lattice target group after the Auto Scaling group has been created.
To attach a VPC Lattice target group to an existing Auto Scaling group
Use the following procedure to attach a target group for a service to an existing Auto Scaling group.
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
Select the check box next to your Auto Scaling group.
A split pane opens up in the bottom of the page.
-
On the Details tab, choose VPC Lattice integration options, Edit.
-
Under VPC Lattice integration options, choose Attach to VPC Lattice service.
-
Under Choose VPC Lattice target group, choose your target group.
-
Choose Update.
When you finish attaching the target group, you can optionally turn on the health checks that use it.
To turn on the VPC Lattice health checks
-
On the Details tab, choose Health checks, Edit.
-
For Health checks, Additional health check types, select Turn on VPC Lattice health checks.
-
For Health check grace period, enter the amount of time, in seconds. This amount of time is how long Amazon EC2 Auto Scaling needs to wait before checking the health status of an instance after it enters the
InService
state. For more information, see Set the health check grace period for an Auto Scaling group. -
Choose Update.
Detach a VPC Lattice target
group
If you no longer need to use VPC Lattice, use the following procedure to detach the target group from your Auto Scaling group.
Follow the steps in this section to use the console to:
-
Detach a VPC Lattice target group from an Auto Scaling group
-
Turn off the health checks for VPC Lattice
To detach a VPC Lattice target group from an Auto Scaling group
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
Select the check box next to an existing group.
A split pane opens up in the bottom of the page.
-
On the Details tab, choose VPC Lattice integration options, Edit.
-
Under VPC Lattice integration options, choose the delete (X) icon next to the target group.
-
Choose Update.
When you finish detaching the target group, you can turn off the VPC Lattice health checks.
To turn off the VPC Lattice health checks
-
On the Details tab, choose Health checks, Edit.
-
For Health checks, Additional health check types, deselect Turn on VPC Lattice health checks.
-
Choose Update.