Menu
Elastic Load Balancing
API Reference (API Version 2015-12-01)

CreateLoadBalancer

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.

For limit 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.

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.

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

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

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.

Type: String

Valid Values: ipv4 | dualstack

Required: No

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.

Type: String

Required: Yes

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.

Type: String

Valid Values: internet-facing | internal

Required: No

SecurityGroups.member.N

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

Type: Array of strings

Required: No

SubnetMappings.member.N

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. You cannot specify Elastic IP addresses for your subnets.

[Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet.

Type: Array of SubnetMapping objects

Required: No

Subnets.member.N

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.

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

Type: Array of strings

Required: No

Tags.member.N

One or more tags to assign to the load balancer.

Type: Array of Tag objects

Array Members: Minimum number of 1 item.

Required: No

Type

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

Type: String

Valid Values: application | network

Required: No

Response Elements

The following element is returned by the service.

LoadBalancers.member.N

Information about the load balancer.

Type: Array of LoadBalancer objects

Errors

For information about the errors that are common to all actions, see Common Errors.

AllocationIdNotFound

The specified allocation ID does not exist.

HTTP Status Code: 400

AvailabilityZoneNotSupported

The specified Availability Zone is not supported.

HTTP Status Code: 400

DuplicateLoadBalancerName

A load balancer with the specified name already exists.

HTTP Status Code: 400

DuplicateTagKeys

A tag key was specified more than once.

HTTP Status Code: 400

InvalidConfigurationRequest

The requested configuration is not valid.

HTTP Status Code: 400

InvalidScheme

The requested scheme is not valid.

HTTP Status Code: 400

InvalidSecurityGroup

The specified security group does not exist.

HTTP Status Code: 400

InvalidSubnet

The specified subnet is out of available addresses.

HTTP Status Code: 400

ResourceInUse

A specified resource is in use.

HTTP Status Code: 400

SubnetNotFound

The specified subnet does not exist.

HTTP Status Code: 400

TooManyLoadBalancers

You've reached the limit on the number of load balancers for your AWS account.

HTTP Status Code: 400

TooManyTags

You've reached the limit on the number of tags per load balancer.

HTTP Status Code: 400

Examples

Create an Internet-facing load balancer

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

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer
&Name=my-load-balancer
&Subnets.member.1=subnet-8360a9e7
&Subnets.member.2=subnet-b7d581c0
&Version=2015-12-01
&AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
  <CreateLoadBalancerResult>
    <LoadBalancers> 
      <member> 
        <LoadBalancerArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/50dc6c495c0c9188</LoadBalancerArn> 
        <Scheme>internet-facing</Scheme> 
        <LoadBalancerName>my-load-balancer</LoadBalancerName> 
        <VpcId>vpc-3ac0fb5f</VpcId> 
        <CanonicalHostedZoneId>Z2P70J7EXAMPLE</CanonicalHostedZoneId> 
        <CreatedTime>2016-03-25T21:29:48.850Z</CreatedTime> 
        <AvailabilityZones> 
          <member> 
            <SubnetId>subnet-8360a9e7</SubnetId> 
            <ZoneName>us-west-2a</ZoneName> 
          </member> 
          <member> 
            <SubnetId>subnet-b7d581c0</SubnetId> 
            <ZoneName>us-west-2b</ZoneName> 
          </member> 
        </AvailabilityZones> 
        <SecurityGroups> 
          <member>sg-5943793c</member> 
        </SecurityGroups> 
        <DNSName>my-load-balancer-424835706.us-west-2.elb.amazonaws.com</DNSName> 
        <State> 
          <Code>provisioning</Code> 
        </State> 
        <Type>application</Type> 
      </member> 
    </LoadBalancers> 
  </CreateLoadBalancerResult> 
  <ResponseMetadata> 
    <RequestId>32d531b2-f2d0-11e5-9192-3fff33344cfa</RequestId> 
  </ResponseMetadata>
</CreateLoadBalancerResponse>

Create an internal load balancer

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

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer
&Name=my-internal-load-balancer
&Scheme=internal
&Subnets.member.1=subnet-8360a9e7
&Subnets.member.2=subnet-b7d581c0
&Version=2015-12-01
&AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
  <CreateLoadBalancerResult>
    <LoadBalancers> 
      <member> 
        <LoadBalancerArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/5b49b8d4303115c2</LoadBalancerArn> 
        <Scheme>internal</Scheme> 
        <LoadBalancerName>my-internal-load-balancer</LoadBalancerName> 
        <VpcId>vpc-3ac0fb5f</VpcId> 
        <CanonicalHostedZoneId>Z2P70J7EXAMPLE</CanonicalHostedZoneId> 
        <CreatedTime>2016-03-25T21:29:48.850Z</CreatedTime> 
        <AvailabilityZones> 
          <member> 
            <SubnetId>subnet-8360a9e7</SubnetId> 
            <ZoneName>us-west-2a</ZoneName> 
          </member> 
          <member> 
            <SubnetId>subnet-b7d581c0</SubnetId> 
            <ZoneName>us-west-2b</ZoneName> 
          </member> 
        </AvailabilityZones> 
        <SecurityGroups> 
          <member>sg-5943793c</member> 
        </SecurityGroups> 
        <DNSName>internal-my-internal-load-balancer-1529930873.us-west-2.elb.amazonaws.com</DNSName> 
        <State> 
          <Code>provisioning</Code> 
        </State> 
        <Type>application</Type> 
      </member> 
    </LoadBalancers> 
  </CreateLoadBalancerResult> 
  <ResponseMetadata> 
    <RequestId>b37b9c3e-f2d0-11e5-a53c-67205c0d10fd</RequestId> 
  </ResponseMetadata>
</CreateLoadBalancerResponse>

Create a Network Load Balancer

This example creates a Network Load Balancer and associates an Elastic IP address with each of the specified subnets.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer
&Name=my-network-load-balancer
&Type=network
&SubnetMappings.member.1.SubnetId=subnet-8360a9e7
&SubnetMappings.member.1.AllocationId=eipalloc-5723d13e
&SubnetMappings.member.2.SubnetId=subnet-b7d581c0
&SubnetMappings.member.2.AllocationId=eipalloc-fc5ca095
&Version=2015-12-01
&AUTHPARAMS

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: