CreateLoadBalancer
Creates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.
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 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.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
- CustomerOwnedIpv4Pool
-
[Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).
Type: String
Length Constraints: Maximum length of 256.
Pattern:
^(ipv4pool-coip-)[a-zA-Z0-9]+$
Required: No
- EnablePrefixForIpv6SourceNat
-
[Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be
dualstack
. The default value isoff
.Type: String
Valid Values:
on | off
Required: No
- IpAddressType
-
The IP address type. Internal load balancers must use
ipv4
.[Application Load Balancers] The possible values are
ipv4
(IPv4 addresses),dualstack
(IPv4 and IPv6 addresses), anddualstack-without-public-ipv4
(public IPv6 addresses and private IPv4 and IPv6 addresses).[Network Load Balancers and Gateway Load Balancers] The possible values are
ipv4
(IPv4 addresses) anddualstack
(IPv4 and IPv6 addresses).Type: String
Valid Values:
ipv4 | dualstack | dualstack-without-public-ipv4
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, must not begin or end with a hyphen, and must not begin with "internal-".
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 route requests only from clients with access to the VPC for the load balancer.
The default is an Internet-facing load balancer.
You can't specify a scheme for a Gateway Load Balancer.
Type: String
Valid Values:
internet-facing | internal
Required: No
- SecurityGroups.member.N
-
[Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer.
Type: Array of strings
Required: No
- SubnetMappings.member.N
-
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 can't 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 can't specify Elastic IP addresses for your subnets.
Type: Array of SubnetMapping objects
Required: No
- Subnets.member.N
-
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 and Gateway Load Balancers] You can specify subnets from one or more Availability Zones.
Type: Array of strings
Required: No
- Tags.member.N
-
The 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. The default is
application
.Type: String
Valid Values:
application | network | gateway
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
- OperationNotPermitted
-
This operation is not allowed.
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 for this resource.
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
Create a Gateway Load Balancer
This example creates a Gateway Load Balancer.
Sample Request
https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer
&Name=my-gateway-load-balancer
&Type=gateway
&Subnets.member.1.SubnetId=subnet-066877671789bd71b
&Subnets.member.2.SubnetId=subnet-09ed24a70bc19bbe4
&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: