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 CreateLoadBalancer operation. 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.

Inheritance Hierarchy

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

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

Syntax

C#
public class CreateLoadBalancerRequest : AmazonElasticLoadBalancingV2Request
         IAmazonWebServiceRequest

The CreateLoadBalancerRequest type exposes the following members

Constructors

NameDescription
Public Method CreateLoadBalancerRequest()

Properties

NameTypeDescription
Public Property IpAddressType Amazon.ElasticLoadBalancingV2.IpAddressType

Gets and sets the property IpAddressType.

[Application Load Balancers] The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). Internal load balancers must use ipv4.

Public Property Name System.String

Gets and sets the property Name.

The name of the load balancer.

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.

Public Property Scheme Amazon.ElasticLoadBalancingV2.LoadBalancerSchemeEnum

Gets and sets the property Scheme.

The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the Internet.

The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can only route requests from clients with access to the VPC for the load balancer.

The default is an Internet-facing load balancer.

Public Property SecurityGroups System.Collections.Generic.List<System.String>

Gets and sets the property SecurityGroups.

[Application Load Balancers] The IDs of the security groups to assign to the load balancer.

Public Property SubnetMappings System.Collections.Generic.List<Amazon.ElasticLoadBalancingV2.Model.SubnetMapping>

Gets and sets the property SubnetMappings.

The IDs of the subnets to attach to the load balancer. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

[Network Load Balancers] You can specify one Elastic IP address per subnet.

[Application Load Balancers] You cannot specify Elastic IP addresses for your subnets.

Public Property Subnets System.Collections.Generic.List<System.String>

Gets and sets the property Subnets.

The IDs of the subnets to attach to the load balancer. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

[Application Load Balancers] You must specify subnets from at least two Availability Zones.

Public Property Tags System.Collections.Generic.List<Amazon.ElasticLoadBalancingV2.Model.Tag>

Gets and sets the property Tags.

One or more tags to assign to the load balancer.

Public Property Type Amazon.ElasticLoadBalancingV2.LoadBalancerTypeEnum

Gets and sets the property Type.

The type of load balancer to create. The default is application.

Examples

This example creates an Internet-facing load balancer and enables the Availability Zones for the specified subnets.

To create an Internet-facing load balancer


var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest 
{
    Name = "my-load-balancer",
    Subnets = new List {
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    }
});

List loadBalancers = response.LoadBalancers;

            

This example creates an internal load balancer and enables the Availability Zones for the specified subnets.

To create an internal load balancer


var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest 
{
    Name = "my-internal-load-balancer",
    Scheme = "internal",
    SecurityGroups = new List {
                    
    },
    Subnets = new List {
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    }
});

List loadBalancers = response.LoadBalancers;

            

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