Create a target group - Elastic Load Balancing
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Create a target group

You register your targets with a target group. By default, the load balancer sends requests to registered targets using the port and protocol that you specified for the target group. You can override this port when you register each target with the target group.

After you create a target group, you can add tags.

To route traffic to the targets in a target group, specify the target group in an action when you create a listener or create a rule for your listener. For more information, see Listener rules. You can specify the same target group in multiple listeners, but these listeners must belong to the same Application Load Balancer. To use a target group with a load balancer, you must verify that the target group is not in use by a listener for any other load balancer.

You can add or remove targets from your target group at any time. For more information, see Register targets with your target group. You can also modify the health check settings for your target group. For more information, see Modify the health check settings of a target group.

New EC2 experience
To create a target group using the new EC2 experience
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. On the navigation pane, under LOAD BALANCING, choose Target Groups.

  3. Choose Create target group.

  4. For Choose a target type, select Instances to register targets by instance ID, IP addresses to register targets by IP address, or Lambda function to register a Lambda function as a target.

  5. For Target group name, type a name for the target group. This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

  6. (Optional) For Protocol and Port, modify the default values as needed.

  7. If the target type is Instances or IP addresses, choose IPv4 or IPv6 as the IP address type, otherwise skip to the next step.

    Note that only targets that have the selected IP address type can be included in this target group. The IP address type cannot be changed after the target group is created.

  8. For VPC, select a virtual private cloud (VPC). Note that for IP addresses target types, the VPCs available for selection are those that support the IP address type that you chose in the previous step.

  9. (Optional) For Protocol version, modify the default value as needed.

  10. (Optional) In the Health checks section, modify the default settings as needed.

  11. If the target type is Lambda function, you can enable health checks by selecting Enable in the Health checks section.

  12. (Optional) Add one or more tags as follows:

    1. Expand the Tags section.

    2. Choose Add tag.

    3. Enter the tag key and the tag value.

  13. Choose Next.

  14. (Optional) Add one or more targets as follows:

    • If the target type is Instances, select one or more instances, enter one or more ports, and then choose Include as pending below.

      Note: The instances must have an assigned primary IPv6 address to be registered with a IPv6 target group.

    • If the target type is IP addresses, do the following:

      1. Select a network VPC from the list, or choose Other private IP addresses.

      2. Enter the IP address manually, or find the IP address using instance details. You can enter up to five IP addresses at a time.

      3. Enter the ports for routing traffic to the specified IP addresses.

      4. Choose Include as pending below.

    • If the target type is a Lambda function, specify a single Lambda function or omit this step and specify a Lambda function later.

  15. Choose Create target group.

  16. (Optional) You can specify the target group in a listener rule. For more information, see Listener Rules.

Old EC2 experience
To create a target group using the old EC2 experience
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. On the navigation pane, under LOAD BALANCING, choose Target Groups.

  3. Choose Create target group.

  4. For Target group name, type a name for the target group. This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

  5. For Target type, select Instance to register targets by instance ID, IP to register IP addresses, and Lambda function to register a Lambda function.

  6. If the target type is Instance or IP, do the following:

    1. (Optional) For Protocol and Port, modify the default values as needed.

    2. (Optional) For Protocol version, modify the default value as needed.

    3. For VPC, select a virtual private cloud (VPC).

  7. If the target type is Lambda function, do the following:

    1. For Lambda function, do one of the following:

      • Select the Lambda function

      • Create a new Lambda function and select it

      • Register the Lambda function after you create the target group

    2. (Optional) To enable health checks, choose Health check, Enable.

  8. (Optional) For Health check settings and Advanced health check settings, modify the default settings as needed.

  9. Choose Create.

  10. (Optional) Add one or more tags as follows:

    1. Select the newly created target group.

    2. On the Tags tab, choose Add/Edit Tags.

    3. On the Add/Edit Tags page, for each tag you add, choose Create Tag and then specify the tag key and tag value. When you have finished adding tags, choose Save.

  11. (Optional) To add targets to the target group, see Register targets with your target group.

  12. (Optional) You can specify the target group in a listener rule. For more information, see Listener Rules.

To create a target group using the Amazon CLI

Use the create-target-group command to create the target group, the add-tags command to tag your target group, and the register-targets command to add targets.