AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the RegisterTargets operation. Registers the specified targets with the specified target group.

By default, the load balancer routes requests to registered targets using the protocol and port number for the target group. Alternatively, you can override the port for a target when you register it.

The target must be in the virtual private cloud (VPC) that you specified for the target group. If the target is an EC2 instance, it must be in the running state when you register it.

Network Load Balancers do not support the following instance types as targets: C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, and T1.

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

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.ElasticLoadBalancingV2.AmazonElasticLoadBalancingV2Request
      Amazon.ElasticLoadBalancingV2.Model.RegisterTargetsRequest

Namespace: Amazon.ElasticLoadBalancingV2.Model
Assembly: AWSSDK.ElasticLoadBalancingV2.dll
Version: 3.x.y.z

Syntax

C#
public class RegisterTargetsRequest : AmazonElasticLoadBalancingV2Request
         IAmazonWebServiceRequest

The RegisterTargetsRequest type exposes the following members

Constructors

NameDescription
Public Method RegisterTargetsRequest()

Properties

NameTypeDescription
Public Property TargetGroupArn System.String

Gets and sets the property TargetGroupArn.

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

Public Property Targets System.Collections.Generic.List<Amazon.ElasticLoadBalancingV2.Model.TargetDescription>

Gets and sets the property Targets.

The targets. The default port for a target is the port for the target group. You can specify a port override. If a target is already registered, you can register it again using a different port.

Examples

This example registers the specified instances with the specified target group.

To register targets with a target group


var response = client.RegisterTargets(new RegisterTargetsRequest 
{
    TargetGroupArn = "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
    Targets = new List {
        new TargetDescription { Id = "i-80c8dd94" },
        new TargetDescription { Id = "i-ceddcd4d" }
    }
});


            

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.

To register targets with a target group using port overrides


var response = client.RegisterTargets(new RegisterTargetsRequest 
{
    TargetGroupArn = "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9",
    Targets = new List {
        new TargetDescription {
            Id = "i-80c8dd94",
            Port = 80
        },
        new TargetDescription {
            Id = "i-80c8dd94",
            Port = 766
        }
    }
});


            

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms