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, Network Load Balancer, or Gateway Load Balancer.

For more information, see the following:

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.

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 CustomerOwnedIpv4Pool System.String

Gets and sets the property CustomerOwnedIpv4Pool.

[Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).

Public Property IpAddressType Amazon.ElasticLoadBalancingV2.IpAddressType

Gets and sets the property IpAddressType.

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).

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, must not begin or end with a hyphen, and must not begin with "internal-".

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 route requests only from clients with access to the VPC for the load balancer.

The default is an Internet-facing load balancer.

You cannot specify a scheme for a Gateway Load Balancer.

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

Gets and sets the property SecurityGroups.

[Application Load Balancers and Network Load Balancers] The IDs of the security groups for 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. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both.

[Application Load Balancers] You must specify subnets from at least two Availability Zones. You cannot specify Elastic IP addresses for your subnets.

[Application Load Balancers on Outposts] You must specify one Outpost subnet.

[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

[Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.

[Gateway Load Balancers] You can specify subnets from one or more Availability Zones. 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. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets.

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

[Application Load Balancers on Outposts] You must specify one Outpost subnet.

[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

[Network Load Balancers] You can specify subnets from one or more Availability Zones.

[Gateway Load Balancers] You can specify subnets from one or more Availability Zones.

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

Gets and sets the property Tags.

The tags to assign to the load balancer.

Public Property Type Amazon.ElasticLoadBalancingV2.LoadBalancerTypeEnum

Gets and sets the property Type.

The type of load balancer. 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 client = new AmazonElasticLoadBalancingV2Client();
var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest 
{
    Name = "my-load-balancer",
    Subnets = new List<string> {
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    }
});

List<LoadBalancer> 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 client = new AmazonElasticLoadBalancingV2Client();
var response = client.CreateLoadBalancer(new CreateLoadBalancerRequest 
{
    Name = "my-internal-load-balancer",
    Scheme = "internal",
    SecurityGroups = new List<string> {
                    
    },
    Subnets = new List<string> {
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    }
});

List<LoadBalancer> loadBalancers = response.LoadBalancers;

            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

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