Prerequisites for getting started with Elastic Load Balancing - Amazon EC2 Auto Scaling

Prerequisites for getting started with Elastic Load Balancing

Follow the procedures in the Elastic Load Balancing documentation to create the load balancer and target group. Skip the step for registering your Amazon EC2 instances. Amazon EC2 Auto Scaling automatically takes care of registering instances. For more information, see Getting started with Elastic Load Balancing in the Elastic Load Balancing User Guide.

Alternatively, if you want to create an Application Load Balancer or Network Load Balancer, you do not need to create the load balancer and target group now. You can create and attach a new Application Load Balancer or Network Load Balancer from the Amazon EC2 Auto Scaling console. For more information, see Configure an Application Load Balancer or Network Load Balancer from the Amazon EC2 Auto Scaling console.

To attach a load balancer to your Auto Scaling group, first make sure you have met these prerequisites:

  • The load balancer and its target group must be in the same network (EC2-Classic or the same VPC) and in the same Region as your Auto Scaling group.

  • The target group must specify a target type of instance. You can't specify a target type of ip when using an Auto Scaling group.

  • The security group for your launch template or launch configuration must be set up to allow traffic from the load balancer to reach your Auto Scaling group. The recommended rules depend on the type of load balancer and the types of backends that the load balancer uses. For example, to route traffic to web servers, allow inbound HTTP access on port 80 from the load balancer.

  • When deploying virtual appliances behind a Gateway Load Balancer, the Amazon Machine Image (AMI) must specify the ID of an AMI that supports the GENEVE protocol to allow the Auto Scaling group to exchange traffic with a Gateway Load Balancer. Also, the security groups that you specify in the launch template or launch configuration must allow UDP traffic on port 6081.

Before allowing your Auto Scaling group to use the results of the Elastic Load Balancing health checks to determine an instance's health, make sure you have met this additional prerequisite:

Tip

If you have bootstrapping scripts that take a while to complete, you can optionally add a launch lifecycle hook to your Auto Scaling group to delay instances from being registered behind the load balancer before your bootstrap scripts have completed successfully and the applications on the instances are ready to accept traffic. You can't add a lifecycle hook when you initially create an Auto Scaling group in the Amazon EC2 Auto Scaling console. You can add a lifecycle hook after the group is created. For more information, see Amazon EC2 Auto Scaling lifecycle hooks.