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.

Creates a target group.

To register targets with the target group, use RegisterTargets. To update the health check settings for the target group, use ModifyTargetGroup. To monitor the health of targets in the target group, use DescribeTargetHealth.

To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule.

To delete a target group, use DeleteTargetGroup.

For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide or Target Groups for Your Network Load Balancers in the Network Load Balancers Guide.

Note:

For PCL this operation is only available in asynchronous form. Please refer to CreateTargetGroupAsync.

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

Syntax

C#
public virtual CreateTargetGroupResponse CreateTargetGroup(
         CreateTargetGroupRequest request
)
Parameters
request
Type: Amazon.ElasticLoadBalancingV2.Model.CreateTargetGroupRequest

Container for the necessary parameters to execute the CreateTargetGroup service method.

Return Value
The response from the CreateTargetGroup service method, as returned by ElasticLoadBalancingV2.

Exceptions

ExceptionCondition
DuplicateTargetGroupNameException A target group with the specified name already exists.
InvalidConfigurationRequestException The requested configuration is not valid.
TooManyTargetGroupsException You've reached the limit on the number of target groups for your AWS account.

Examples

This example creates a target group that you can use to route traffic to targets using HTTP on port 80. This target group uses the default health check configuration.

To create a target group


var response = client.CreateTargetGroup(new CreateTargetGroupRequest 
{
    Name = "my-targets",
    Port = 80,
    Protocol = "HTTP",
    VpcId = "vpc-3ac0fb5f"
});

List targetGroups = response.TargetGroups;

            

Version Information

.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

See Also