| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The AWS::ElasticLoadBalancing::LoadBalancer type creates a LoadBalancer.
This type supports updates. For more information about updating stacks, see Updating AWS CloudFormation Stacks.
Important
If you update the property values for a listener specified by the Listeners property, AWS CloudFormation will delete the existing listener and create a new one with the updated properties. During the time that AWS CloudFormation is performing this action, clients will not be able to connect to the load balancer.
{
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties": {
"AppCookieStickinessPolicy" : [ AppCookieStickinessPolicy, ... ],
"AvailabilityZones" : [ String, ... ],
"HealthCheck" : HealthCheck,
"Instances" : [ String, ... ],
"LBCookieStickinessPolicy" : [ LBCookieStickinessPolicy, ... ],
"Listeners" : [ Listener, ... ],
"Policies" : [ ElasticLoadBalancing Policy, ... ],
"Scheme" : String,
"SecurityGroups" : [ Security Group, ... ],
"Subnets" : [ String, ... ]
}
}Generates one or more stickiness policies with sticky session lifetimes that follow that of an application-generated cookie. These policies can be associated only with HTTP/HTTPS listeners.
Required: No.
Type: A list of AppCookieStickinessPolicy objects.
The Availability Zones in which to create the load balancer. You can specify either AvailabilityZones or Subnets, but not both.
Required: No.
Type: A list of strings.
When specified, declares an application health check for the instances.
Required: No.
Provides a list of EC2 instance IDs for the load balancer.
Required: No.
Type: A list of strings.
Generates a stickiness policy with sticky session lifetimes controlled by the lifetime of the browser (user-agent), or by a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners.
Required: No.
Type: A list of LBCookieStickinessPolicy objects.
One or more listeners for this load balancer. Each listener must be registered for a specific port, and you cannot have more than one listener for a given port.
Required: Yes.
Type: A list of ElasticLoadBalancing Listener Property Type objects.
A list of elastic load balancing policies to apply to this elastic load balancer.
Required: No.
Type: A list of ElasticLoadBalancing policy objects.
For load balancers attached to an Amazon VPC, this parameter can be used to specify the type of
load balancer to use. Specify "internal" to create an internal load balancer
with a DNS name that resolves to private IP addresses.
Required: No.
Type: String.
Required: No.
Type: A list of security groups assigned to your load balancer within your virtual private cloud (VPC).
Update requires: no interruption
A list of subnet IDs in your virtual private cloud (VPC) to attach to your load balancer. You can specify either AvailabilityZones or Subnets, but not both.
Required: No.
Type: A list of strings.
For more information about using Elastic Load Balancing in a VPC, see How Do I Use Elastic Load Balancing in Amazon VPC in the Elastic Load Balancing Developer Guide.
When the logical ID of this resource is provided to the Ref intrinsic
function, it returns the resource name. For example, mystack-myelb-1WQN7BJGDB5YQ.
For more information about using the Ref function, see Ref.
Fn::GetAtt returns a value for a specified attribute of this type.
This section lists the available attributes and corresponding return values.
The name of the Route 53 hosted zone that is associated with the load balancer.
Example: mystack-myelb-15HMABG9ZCN57-1013119603.us-east-1.elb.amazonaws.com
The ID of the Route 53 hosted zone name that is associated with the load balancer.
Example: Z3DZXE0Q79N41H
The DNS name for the load balancer.
Example: mystack-myelb-15HMABG9ZCN57-1013119603.us-east-1.elb.amazonaws.com
The security group that you can use as part of your inbound rules for your load balancer's back-end Amazon EC2 application instances.
Example: amazon-elb
The owner of the source security group.
Example: amazon-elb-sg
For more information about using Fn:GetAtt, see Fn::GetAtt.
"ElasticLoadBalancer" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties" : {
"AvailabilityZones" : { "Fn::GetAZs" : "" },
"Instances" : [ { "Ref" : "Ec2Instance1" },{ "Ref" : "Ec2Instance2" } ],
"Listeners" : [ {
"LoadBalancerPort" : "80",
"InstancePort" : { "Ref" : "WebServerPort" },
"Protocol" : "HTTP"
} ],
"HealthCheck" : {
"Target" : {
"Fn::Join" : [ "", [ "HTTP:", { "Ref" : "WebServerPort" }, "/" ] ]
},
"HealthyThreshold" : "3",
"UnhealthyThreshold" : "5",
"Interval" : "30",
"Timeout" : "5"
}
}
}Examples of AWS CloudFormation templates can be viewed and downloaded from the AWS CloudFormation Sample Templates. These include:
ELBSample.template: A load balancer with a health check.
ELBStickinessSample.template: A load balancer example configured with cookie-based stickiness.
ELBWithLockedDownEC2Instances.template: A load balancer with instances that receive traffic only from the load balancer.
ELBWithLockedDownAutoScaledInstances.template: A load balancer with an auto scaling group that receives traffic only from the load balancer.
ELBZoneApex.template: Maps a load balancer to a DNS zone apex.
CreateLoadBalancer in the Elastic Load Balancing API Reference