CreateLoadBalancer - Elastic Load Balancing

CreateLoadBalancer

Creates a Classic Load Balancer.

You can add listeners, security groups, subnets, and tags when you create your load balancer, or you can add them later using CreateLoadBalancerListeners, ApplySecurityGroupsToLoadBalancer, AttachLoadBalancerToSubnets, and AddTags.

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 Quotas for your Classic Load Balancer in the User Guide for Classic Load Balancers.

Request Parameters

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

AvailabilityZones.member.N

One or more Availability Zones from the same region as the load balancer.

You must specify at least one Availability Zone.

You can add more Availability Zones after you create the load balancer using EnableAvailabilityZonesForLoadBalancer.

Type: Array of strings

Required: No

Listeners.member.N

The listeners.

For more information, see Listeners for your Classic Load Balancer in the User Guide for Classic Load Balancers.

Type: Array of Listener objects

Required: Yes

LoadBalancerName

The name of the load balancer.

This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.

Type: String

Required: Yes

Scheme

The type of a load balancer. Valid only for load balancers in a VPC.

By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load balancer scheme in the Elastic Load Balancing User Guide.

Specify internal to create a load balancer with a DNS name that resolves to private IP addresses.

Type: String

Required: No

SecurityGroups.member.N

The IDs of the security groups to assign to the load balancer.

Type: Array of strings

Required: No

Subnets.member.N

The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone specified in AvailabilityZones.

Type: Array of strings

Required: No

Tags.member.N

A list of tags to assign to the load balancer.

For more information about tagging your load balancer, see Tag your Classic Load Balancer in the User Guide for Classic Load Balancers.

Type: Array of Tag objects

Array Members: Minimum number of 1 item.

Required: No

Response Elements

The following element is returned by the service.

DNSName

The DNS name of the load balancer.

Type: String

Errors

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

CertificateNotFound

The specified ARN does not refer to a valid SSL certificate in AWS Identity and Access Management (IAM) or AWS Certificate Manager (ACM). Note that if you recently uploaded the certificate to IAM, this error might indicate that the certificate is not fully available yet.

HTTP Status Code: 400

DuplicateLoadBalancerName

The specified load balancer name already exists for this account.

HTTP Status Code: 400

DuplicateTagKeys

A tag key was specified more than once.

HTTP Status Code: 400

InvalidConfigurationRequest

The requested configuration change is not valid.

HTTP Status Code: 409

InvalidScheme

The specified value for the schema is not valid. You can only specify a scheme for load balancers in a VPC.

HTTP Status Code: 400

InvalidSecurityGroup

One or more of the specified security groups do not exist.

HTTP Status Code: 400

InvalidSubnet

The specified VPC has no associated Internet gateway.

HTTP Status Code: 400

OperationNotPermitted

This operation is not allowed.

HTTP Status Code: 400

SubnetNotFound

One or more of the specified subnets do not exist.

HTTP Status Code: 400

TooManyLoadBalancers

The quota for the number of load balancers has been reached.

HTTP Status Code: 400

TooManyTags

The quota for the number of tags that can be assigned to a load balancer has been reached.

HTTP Status Code: 400

UnsupportedProtocol

The specified protocol or signature version is not supported.

HTTP Status Code: 400

Examples

Create a Classic Load Balancer

This example creates an HTTP load balancer in the specified subnet.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer &LoadBalancerName=my-vpc-loadbalancer &Listeners.member.1.LoadBalancerPort=80 &Listeners.member.1.InstancePort=80 &Listeners.member.1.Protocol=http &Listeners.member.1.InstanceProtocol=http &Subnets.member.1=subnet-6dec9f03 &SecurityGroups.member.1=sg-6801da07 &Version=2012-06-01 &AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <CreateLoadBalancerResult> <DNSName>my-vpc-loadbalancer-1234567890.us-east-1.elb.amazonaws.com</DNSName> </CreateLoadBalancerResult> <ResponseMetadata> <RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId> </ResponseMetadata> </CreateLoadBalancerResponse>

Create an internal load balancer

This example creates an internal HTTP load balancer in the specified subnet.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer &LoadBalancerName=my-internal-loadbalancer &Scheme=internal &SecurityGroups.member.1=sg-706cb61f &Listeners.member.1.LoadBalancerPort=80 &Listeners.member.1.InstancePort=80 &Listeners.member.1.Protocol=http &Listeners.member.1.InstanceProtocol=http &Subnets.member.1=subnet-9edc97f0 &Version=2012-06-01 &AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <CreateLoadBalancerResult> <DNSName>internal-my-internal-loadbalancer-1234567890.us-east-1.elb.amazonaws.com</DNSName> </CreateLoadBalancerResult> <ResponseMetadata> <RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId> </ResponseMetadata> </CreateLoadBalancerResponse>

Create a load balancer in a default VPC

This example creates a load balancer in the default VPC for the specified Region.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer &LoadBalancerName=my-defaultvpc-loadbalancer &AvailabilityZones.member.1=sa-east-1b &Listeners.member.1.LoadBalancerPort=80 &Listeners.member.1.InstancePort=80 &Listeners.member.1.Protocol=http &Listeners.member.1.InstanceProtocol=http &Version=2012-06-01 &AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <CreateLoadBalancerResult> <DNSName>my-defaultvpc-loadbalancer-1234567890.sa.east-1.elb.amazonaws.com</DNSName> </CreateLoadBalancerResult> <ResponseMetadata> <RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId> </ResponseMetadata> </CreateLoadBalancerResponse>

Create a load balancer and assign a tag

This example creates an HTTP load balancer and assigns it a tag.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=CreateLoadBalancer &LoadBalancerName=my-loadbalancer &AvailabilityZones.member.1=us-east-1c; &Listeners.member.1.LoadBalancerPort=80 &Listeners.member.1.InstancePort=80 &Listeners.member.1.Protocol=http &Listeners.member.1.InstanceProtocol=http &Tags.member.1.Value=digital-media &Tags.member.1.Key=department &Version=2012-06-01 &AUTHPARAMS

Sample Response

<CreateLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <CreateLoadBalancerResult> <DNSName>my-loadbalancer-1234567890.us-east-1.elb.amazonaws.com</DNSName> </CreateLoadBalancerResult> <ResponseMetadata> <RequestId>1549581b-12b7-11e3-895e-1334aEXAMPLE</RequestId> </ResponseMetadata> </CreateLoadBalancerResponse>

See Also

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