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.

Implementation for accessing ElasticLoadBalancingV2 Elastic Load Balancing

A load balancer distributes incoming traffic across targets, such as your EC2 instances. This enables you to increase the availability of your application. The load balancer also monitors the health of its registered targets and ensures that it routes traffic only to healthy targets. You configure your load balancer to accept incoming traffic by specifying one or more listeners, which are configured with a protocol and port number for connections from clients to the load balancer. You configure a target group with a protocol and port number for connections from the load balancer to the targets, and with health check settings to be used when checking the health status of the targets.

Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers.

An Application Load Balancer makes routing and load balancing decisions at the application layer (HTTP/HTTPS). A Network Load Balancer makes routing and load balancing decisions at the transport layer (TCP). Both Application Load Balancers and Network Load Balancers can route requests to one or more ports on each EC2 instance or container instance in your virtual private cloud (VPC).

A Classic Load Balancer makes routing and load balancing decisions either at the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS), and supports either EC2-Classic or a VPC. For more information, see the Elastic Load Balancing User Guide.

This reference covers the 2015-12-01 API, which supports Application Load Balancers and Network Load Balancers. The 2012-06-01 API supports Classic Load Balancers.

To get started, complete the following tasks:

  1. Create a load balancer using CreateLoadBalancer.

  2. Create a target group using CreateTargetGroup.

  3. Register targets for the target group using RegisterTargets.

  4. Create one or more listeners for your load balancer using CreateListener.

To delete a load balancer and its related resources, complete the following tasks:

  1. Delete the load balancer using DeleteLoadBalancer.

  2. Delete the target group using DeleteTargetGroup.

All Elastic Load Balancing operations are idempotent, which means that they complete at most one time. If you repeat an operation, it succeeds.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonServiceClient
    Amazon.ElasticLoadBalancingV2.AmazonElasticLoadBalancingV2Client

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

Syntax

C#
public class AmazonElasticLoadBalancingV2Client : AmazonServiceClient
         IAmazonElasticLoadBalancingV2, IAmazonService, IDisposable

The AmazonElasticLoadBalancingV2Client type exposes the following members

Constructors

NameDescription
Public Method AmazonElasticLoadBalancingV2Client()

Constructs AmazonElasticLoadBalancingV2Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.



    
        
    

             

Public Method AmazonElasticLoadBalancingV2Client(RegionEndpoint)

Constructs AmazonElasticLoadBalancingV2Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.



    
        
    

             

Public Method AmazonElasticLoadBalancingV2Client(AmazonElasticLoadBalancingV2Config)

Constructs AmazonElasticLoadBalancingV2Client with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.



    
        
    

             

Public Method AmazonElasticLoadBalancingV2Client(AWSCredentials)

Constructs AmazonElasticLoadBalancingV2Client with AWS Credentials

Public Method AmazonElasticLoadBalancingV2Client(AWSCredentials, RegionEndpoint)

Constructs AmazonElasticLoadBalancingV2Client with AWS Credentials

Public Method AmazonElasticLoadBalancingV2Client(AWSCredentials, AmazonElasticLoadBalancingV2Config)

Constructs AmazonElasticLoadBalancingV2Client with AWS Credentials and an AmazonElasticLoadBalancingV2Client Configuration object.

Public Method AmazonElasticLoadBalancingV2Client(string, string)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID and AWS Secret Key

Public Method AmazonElasticLoadBalancingV2Client(string, string, RegionEndpoint)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID and AWS Secret Key

Public Method AmazonElasticLoadBalancingV2Client(string, string, AmazonElasticLoadBalancingV2Config)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID, AWS Secret Key and an AmazonElasticLoadBalancingV2Client Configuration object.

Public Method AmazonElasticLoadBalancingV2Client(string, string, string)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID and AWS Secret Key

Public Method AmazonElasticLoadBalancingV2Client(string, string, string, RegionEndpoint)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID and AWS Secret Key

Public Method AmazonElasticLoadBalancingV2Client(string, string, string, AmazonElasticLoadBalancingV2Config)

Constructs AmazonElasticLoadBalancingV2Client with AWS Access Key ID, AWS Secret Key and an AmazonElasticLoadBalancingV2Client Configuration object.

Properties

NameTypeDescription
Public Property Config Amazon.Runtime.IClientConfig Inherited from Amazon.Runtime.AmazonServiceClient.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method AddTags(AddTagsRequest)

Adds the specified tags to the specified Elastic Load Balancing resource. You can tag your Application Load Balancers, Network Load Balancers, and your target groups.

Each tag consists of a key and an optional value. If a resource already has a tag with the same key, AddTags updates its value.

To list the current tags for your resources, use DescribeTags. To remove tags from your resources, use RemoveTags.

Public Method AddTagsAsync(AddTagsRequest, CancellationToken)

Initiates the asynchronous execution of the AddTags operation.

Public Method CreateListener(CreateListenerRequest)

Creates a listener for the specified Application Load Balancer or Network Load Balancer.

You can create up to 10 listeners per load balancer.

To update a listener, use ModifyListener. When you are finished with a listener, you can delete it using DeleteListener. If you are finished with both the listener and the load balancer, you can delete them both using DeleteLoadBalancer.

For more information, see Listeners for Your Application Load Balancers in the Application Load Balancers Guide and Listeners for Your Network Load Balancers in the Network Load Balancers Guide.

Public Method CreateListenerAsync(CreateListenerRequest, CancellationToken)

Initiates the asynchronous execution of the CreateListener operation.

Public Method CreateLoadBalancer(CreateLoadBalancerRequest)

Creates an Application Load Balancer or a Network Load Balancer.

When you create a load balancer, you can specify security groups, subnets, IP address type, and tags. Otherwise, you could do so later using SetSecurityGroups, SetSubnets, SetIpAddressType, and AddTags.

To create listeners for your load balancer, use CreateListener. To describe your current load balancers, see DescribeLoadBalancers. When you are finished with a load balancer, you can delete it using DeleteLoadBalancer.

You can create up to 20 load balancers per region per account. You can request an increase for the number of load balancers for your account. For more information, see Limits for Your Application Load Balancer in the Application Load Balancers Guide and Limits for Your Network Load Balancer in the Network Load Balancers Guide.

For more information, see Application Load Balancers in the Application Load Balancers Guide and Network Load Balancers in the Network Load Balancers Guide.

Public Method CreateLoadBalancerAsync(CreateLoadBalancerRequest, CancellationToken)

Initiates the asynchronous execution of the CreateLoadBalancer operation.

Public Method CreateRule(CreateRuleRequest)

Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.

Rules are evaluated in priority order, from the lowest value to the highest value. When the condition for a rule is met, the specified action is taken. If no conditions are met, the action for the default rule is taken. For more information, see Listener Rules in the Application Load Balancers Guide.

To view your current rules, use DescribeRules. To update a rule, use ModifyRule. To set the priorities of your rules, use SetRulePriorities. To delete a rule, use DeleteRule.

Public Method CreateRuleAsync(CreateRuleRequest, CancellationToken)

Initiates the asynchronous execution of the CreateRule operation.

Public Method CreateTargetGroup(CreateTargetGroupRequest)

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.

Public Method CreateTargetGroupAsync(CreateTargetGroupRequest, CancellationToken)

Initiates the asynchronous execution of the CreateTargetGroup operation.

Public Method DeleteListener(DeleteListenerRequest)

Deletes the specified listener.

Alternatively, your listener is deleted when you delete the load balancer it is attached to using DeleteLoadBalancer.

Public Method DeleteListenerAsync(DeleteListenerRequest, CancellationToken)

Initiates the asynchronous execution of the DeleteListener operation.

Public Method DeleteLoadBalancer(DeleteLoadBalancerRequest)

Deletes the specified Application Load Balancer or Network Load Balancer and its attached listeners.

You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds.

Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.

Public Method DeleteLoadBalancerAsync(DeleteLoadBalancerRequest, CancellationToken)

Initiates the asynchronous execution of the DeleteLoadBalancer operation.

Public Method DeleteRule(DeleteRuleRequest)

Deletes the specified rule.

Public Method DeleteRuleAsync(DeleteRuleRequest, CancellationToken)

Initiates the asynchronous execution of the DeleteRule operation.

Public Method DeleteTargetGroup(DeleteTargetGroupRequest)

Deletes the specified target group.

You can delete a target group if it is not referenced by any actions. Deleting a target group also deletes any associated health checks.

Public Method DeleteTargetGroupAsync(DeleteTargetGroupRequest, CancellationToken)

Initiates the asynchronous execution of the DeleteTargetGroup operation.

Public Method DeregisterTargets(DeregisterTargetsRequest)

Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.

Public Method DeregisterTargetsAsync(DeregisterTargetsRequest, CancellationToken)

Initiates the asynchronous execution of the DeregisterTargets operation.

Public Method DescribeAccountLimits(DescribeAccountLimitsRequest)

Describes the current Elastic Load Balancing resource limits for your AWS account.

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

Public Method DescribeAccountLimitsAsync(DescribeAccountLimitsRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeAccountLimits operation.

Public Method DescribeListeners(DescribeListenersRequest)

Describes the specified listeners or the listeners for the specified Application Load Balancer or Network Load Balancer. You must specify either a load balancer or one or more listeners.

Public Method DescribeListenersAsync(DescribeListenersRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeListeners operation.

Public Method DescribeLoadBalancerAttributes(DescribeLoadBalancerAttributesRequest)

Describes the attributes for the specified Application Load Balancer or Network Load Balancer.

Public Method DescribeLoadBalancerAttributesAsync(DescribeLoadBalancerAttributesRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeLoadBalancerAttributes operation.

Public Method DescribeLoadBalancers(DescribeLoadBalancersRequest)

Describes the specified load balancers or all of your load balancers.

To describe the listeners for a load balancer, use DescribeListeners. To describe the attributes for a load balancer, use DescribeLoadBalancerAttributes.

Public Method DescribeLoadBalancersAsync(DescribeLoadBalancersRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeLoadBalancers operation.

Public Method DescribeRules(DescribeRulesRequest)

Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.

Public Method DescribeRulesAsync(DescribeRulesRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeRules operation.

Public Method DescribeSSLPolicies(DescribeSSLPoliciesRequest)

Describes the specified policies or all policies used for SSL negotiation.

For more information, see Security Policies in the Application Load Balancers Guide.

Public Method DescribeSSLPoliciesAsync(DescribeSSLPoliciesRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeSSLPolicies operation.

Public Method DescribeTags(DescribeTagsRequest)

Describes the tags for the specified resources. You can describe the tags for one or more Application Load Balancers, Network Load Balancers, and target groups.

Public Method DescribeTagsAsync(DescribeTagsRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeTags operation.

Public Method DescribeTargetGroupAttributes(DescribeTargetGroupAttributesRequest)

Describes the attributes for the specified target group.

Public Method DescribeTargetGroupAttributesAsync(DescribeTargetGroupAttributesRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeTargetGroupAttributes operation.

Public Method DescribeTargetGroups(DescribeTargetGroupsRequest)

Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.

To describe the targets for a target group, use DescribeTargetHealth. To describe the attributes of a target group, use DescribeTargetGroupAttributes.

Public Method DescribeTargetGroupsAsync(DescribeTargetGroupsRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeTargetGroups operation.

Public Method DescribeTargetHealth(DescribeTargetHealthRequest)

Describes the health of the specified targets or all of your targets.

Public Method DescribeTargetHealthAsync(DescribeTargetHealthRequest, CancellationToken)

Initiates the asynchronous execution of the DescribeTargetHealth operation.

Public Method Dispose() Inherited from Amazon.Runtime.AmazonServiceClient.
Public Method ModifyListener(ModifyListenerRequest)

Modifies the specified properties of the specified listener.

Any properties that you do not specify retain their current values. However, changing the protocol from HTTPS to HTTP removes the security policy and SSL certificate properties. If you change the protocol from HTTP to HTTPS, you must add the security policy and server certificate.

Public Method ModifyListenerAsync(ModifyListenerRequest, CancellationToken)

Initiates the asynchronous execution of the ModifyListener operation.

Public Method ModifyLoadBalancerAttributes(ModifyLoadBalancerAttributesRequest)

Modifies the specified attributes of the specified Application Load Balancer or Network Load Balancer.

If any of the specified attributes can't be modified as requested, the call fails. Any existing attributes that you do not modify retain their current values.

Public Method ModifyLoadBalancerAttributesAsync(ModifyLoadBalancerAttributesRequest, CancellationToken)

Initiates the asynchronous execution of the ModifyLoadBalancerAttributes operation.

Public Method ModifyRule(ModifyRuleRequest)

Modifies the specified rule.

Any existing properties that you do not modify retain their current values.

To modify the default action, use ModifyListener.

Public Method ModifyRuleAsync(ModifyRuleRequest, CancellationToken)

Initiates the asynchronous execution of the ModifyRule operation.

Public Method ModifyTargetGroup(ModifyTargetGroupRequest)

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

To monitor the health of the targets, use DescribeTargetHealth.

Public Method ModifyTargetGroupAsync(ModifyTargetGroupRequest, CancellationToken)

Initiates the asynchronous execution of the ModifyTargetGroup operation.

Public Method ModifyTargetGroupAttributes(ModifyTargetGroupAttributesRequest)

Modifies the specified attributes of the specified target group.

Public Method ModifyTargetGroupAttributesAsync(ModifyTargetGroupAttributesRequest, CancellationToken)

Initiates the asynchronous execution of the ModifyTargetGroupAttributes operation.

Public Method RegisterTargets(RegisterTargetsRequest)

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.

Public Method RegisterTargetsAsync(RegisterTargetsRequest, CancellationToken)

Initiates the asynchronous execution of the RegisterTargets operation.

Public Method RemoveTags(RemoveTagsRequest)

Removes the specified tags from the specified Elastic Load Balancing resource.

To list the current tags for your resources, use DescribeTags.

Public Method RemoveTagsAsync(RemoveTagsRequest, CancellationToken)

Initiates the asynchronous execution of the RemoveTags operation.

Public Method SetIpAddressType(SetIpAddressTypeRequest)

Sets the type of IP addresses used by the subnets of the specified Application Load Balancer or Network Load Balancer.

Note that Network Load Balancers must use ipv4.

Public Method SetIpAddressTypeAsync(SetIpAddressTypeRequest, CancellationToken)

Initiates the asynchronous execution of the SetIpAddressType operation.

Public Method SetRulePriorities(SetRulePrioritiesRequest)

Sets the priorities of the specified rules.

You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority.

Public Method SetRulePrioritiesAsync(SetRulePrioritiesRequest, CancellationToken)

Initiates the asynchronous execution of the SetRulePriorities operation.

Public Method SetSecurityGroups(SetSecurityGroupsRequest)

Associates the specified security groups with the specified Application Load Balancer. The specified security groups override the previously associated security groups.

Note that you can't specify a security group for a Network Load Balancer.

Public Method SetSecurityGroupsAsync(SetSecurityGroupsRequest, CancellationToken)

Initiates the asynchronous execution of the SetSecurityGroups operation.

Public Method SetSubnets(SetSubnetsRequest)

Enables the Availability Zone for the specified subnets for the specified Application Load Balancer. The specified subnets replace the previously enabled subnets.

Note that you can't change the subnets for a Network Load Balancer.

Public Method SetSubnetsAsync(SetSubnetsRequest, CancellationToken)

Initiates the asynchronous execution of the SetSubnets operation.

Events

NameDescription
Event AfterResponseEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event BeforeRequestEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event ExceptionEvent Inherited from Amazon.Runtime.AmazonServiceClient.

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