Menu
Elastic Load Balancing
API Reference (API Version 2015-12-01)

RegisterTargets

Registers the specified targets with the specified target group.

You can register targets by instance ID or by IP address. If the target is an EC2 instance, it must be in the running state when you register it.

By default, the load balancer routes requests to registered targets using the protocol and port for the target group. Alternatively, you can override the port for a target when you register it. You can register each EC2 instance or IP address with the same target group multiple times using different ports.

With a Network Load Balancer, you cannot register instances by instance ID if they have the following instance types: C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, and T1. You can register instances of these types by IP address.

To remove a target from a target group, use DeregisterTargets.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

TargetGroupArn

The Amazon Resource Name (ARN) of the target group.

Type: String

Required: Yes

Targets.member.N

The targets.

Type: Array of TargetDescription objects

Required: Yes

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidTarget

The specified target does not exist or is not in the same VPC as the target group.

HTTP Status Code: 400

TargetGroupNotFound

The specified target group does not exist.

HTTP Status Code: 400

TooManyRegistrationsForTargetId

You've reached the limit on the number of times a target can be registered with a load balancer.

HTTP Status Code: 400

TooManyTargets

You've reached the limit on the number of targets.

HTTP Status Code: 400

Examples

Register targets by instance ID

This example registers the specified instance IDs with the specified target group.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=RegisterTargets
&TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
&Targets.member.1.Id=i-80c8dd94
&Targets.member.2.Id=i-ceddcd4d
&Version=2015-12-01
&AUTHPARAMS

Register targets by IP address

This example registers the specified IP addresses with the specified target group.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=RegisterTargets
&TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
&Targets.member.1.Id=10.0.42.17
&Targets.member.2.Id=192.168.0.3
&Targets.member.2.AvailabilityZone=all
&Version=2015-12-01
&AUTHPARAMS

Register targets with a target group using port overrides

This example registers the specified instance with the specified target group using multiple ports. This enables you to register ECS containers on the same instance as targets in the target group.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=RegisterTargets
&TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
&Targets.member.1.Id=i-80c8dd94
&Targets.member.1.Port=80
&Targets.member.2.Id=i-80c8dd94
&Targets.member.2.Port=766
&Version=2015-12-01
&AUTHPARAMS

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: