Elastic Load Balancing: User Guide
Elastic Load Balancing: User Guide
User Guide
Elastic Load Balancing User Guide
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not
Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or
discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may
or may not be affiliated with, connected to, or sponsored by Amazon.
Elastic Load Balancing User Guide
Table of Contents
What is Elastic Load Balancing? ........................................................................................................... 1
Load balancer benefits ................................................................................................................ 1
Features of Elastic Load Balancing ............................................................................................... 1
Accessing Elastic Load Balancing .................................................................................................. 1
Related services ......................................................................................................................... 2
Pricing ...................................................................................................................................... 2
How Elastic Load Balancing works ........................................................................................................ 3
Availability Zones and load balancer nodes ................................................................................... 3
Cross-zone load balancing ................................................................................................... 3
Request routing ......................................................................................................................... 5
Routing algorithm .............................................................................................................. 5
HTTP connections .............................................................................................................. 5
HTTP headers .................................................................................................................... 6
HTTP header limits ............................................................................................................ 6
Load balancer scheme ................................................................................................................ 7
Network MTU ............................................................................................................................ 7
Getting started .................................................................................................................................. 9
Create an Application Load Balancer ............................................................................................ 9
Create a Network Load Balancer .................................................................................................. 9
Create a Gateway Load Balancer .................................................................................................. 9
Create a Classic Load Balancer ..................................................................................................... 9
Security ........................................................................................................................................... 10
Data protection ........................................................................................................................ 10
Encryption at rest ............................................................................................................. 11
Encryption in transit ......................................................................................................... 11
Identity and access management ............................................................................................... 11
Grant permissions using IAM policies .................................................................................. 12
API actions for Elastic Load Balancing ................................................................................. 12
Elastic Load Balancing resources ........................................................................................ 13
Resource-level permissions for Elastic Load Balancing ........................................................... 14
Condition keys for Elastic Load Balancing ............................................................................ 16
Predefined AWS managed policies ...................................................................................... 17
API permissions ................................................................................................................ 18
Service-linked role ............................................................................................................ 19
Compliance validation ............................................................................................................... 21
Resilience ................................................................................................................................ 21
Infrastructure security ............................................................................................................... 22
Network isolation ............................................................................................................. 22
Controlling network traffic ................................................................................................ 22
Interface VPC endpoints ............................................................................................................ 23
Create an interface endpoint for Elastic Load Balancing ........................................................ 23
Create a VPC endpoint policy for Elastic Load Balancing ........................................................ 24
Migrate your Classic Load Balancer ..................................................................................................... 25
Step 1: Create a new load balancer ............................................................................................ 25
Option 1: Use the migration wizard in the console ............................................................... 25
Option 2: Use the load balancer copy utility from github ....................................................... 26
Option 3: Migrate manually to an Application Load Balancer or Network Load Balancer .............. 27
Option 4: Migrate manually to a Classic Load Balancer in a VPC ............................................. 27
Step 2: Gradually redirect traffic to your new load balancer ........................................................... 28
Step 3: Update policies, scripts, and code .................................................................................... 28
Step 4: Delete the old load balancer ........................................................................................... 29
iii
Elastic Load Balancing User Guide
Load balancer benefits
You can add and remove compute resources from your load balancer as your needs change, without
disrupting the overall flow of requests to your applications.
You can configure health checks, which monitor the health of the compute resources, so that the load
balancer sends requests only to the healthy ones. You can also offload the work of encryption and
decryption to your load balancer so that your compute resources can focus on their main work.
For more information about using each load balancer, see the User Guide for Application Load Balancers,
the User Guide for Network Load Balancers, the User Guide for Gateway Load Balancers, and the User
Guide for Classic Load Balancers.
• AWS Management Console— Provides a web interface that you can use to access Elastic Load
Balancing.
• AWS Command Line Interface (AWS CLI) — Provides commands for a broad set of AWS services,
including Elastic Load Balancing. The AWS CLI is supported on Windows, macOS, and Linux. For more
information, see AWS Command Line Interface.
• AWS SDKs — Provide language-specific APIs and take care of many of the connection details, such as
calculating signatures, handling request retries, and error handling. For more information, see AWS
SDKs.
• Query API— Provides low-level API actions that you call using HTTPS requests. Using the Query
API is the most direct way to access Elastic Load Balancing. However, the Query API requires that
your application handle low-level details such as generating the hash to sign the request, and error
handling. For more information, see the following:
• Application Load Balancers and Network Load Balancers — API version 2015-12-01
1
Elastic Load Balancing User Guide
Related services
Related services
Elastic Load Balancing works with the following services to improve the availability and scalability of
your applications.
• Amazon EC2 — Virtual servers that run your applications in the cloud. You can configure your load
balancer to route traffic to your EC2 instances. For more information, see the Amazon EC2 User Guide
for Linux Instances or the Amazon EC2 User Guide for Windows Instances.
• Amazon EC2 Auto Scaling — Ensures that you are running your desired number of instances, even if
an instance fails. Amazon EC2 Auto Scaling also enables you to automatically increase or decrease the
number of instances as the demand on your instances changes. If you enable Auto Scaling with Elastic
Load Balancing, instances that are launched by Auto Scaling are automatically registered with the load
balancer. Likewise, instances that are terminated by Auto Scaling are automatically de-registered from
the load balancer. For more information, see the Amazon EC2 Auto Scaling User Guide.
• AWS Certificate Manager — When you create an HTTPS listener, you can specify certificates provided
by ACM. The load balancer uses certificates to terminate connections and decrypt requests from
clients.
• Amazon CloudWatch — Enables you to monitor your load balancer and to take action as needed. For
more information, see the Amazon CloudWatch User Guide.
• Amazon ECS — Enables you to run, stop, and manage Docker containers on a cluster of EC2 instances.
You can configure your load balancer to route traffic to your containers. For more information, see the
Amazon Elastic Container Service Developer Guide.
• AWS Global Accelerator — Improves the availability and performance of your application. Use an
accelerator to distribute traffic across multiple load balancers in one or more AWS Regions. For more
information, see the AWS Global Accelerator Developer Guide.
• Route 53 — Provides a reliable and cost-effective way to route visitors to websites by translating
domain names into the numeric IP addresses that computers use to connect to each other. For
example, it would translate www.example.com into the numeric IP address 192.0.2.1. AWS assigns
URLs to your resources, such as load balancers. However, you might want a URL that is easy for users
to remember. For example, you can map your domain name to a load balancer. For more information,
see the Amazon Route 53 Developer Guide.
• AWS WAF — You can use AWS WAF with your Application Load Balancer to allow or block requests
based on the rules in a web access control list (web ACL). For more information, see the AWS WAF
Developer Guide.
Pricing
With your load balancer, you pay only for what you use. For more information, see Elastic Load Balancing
pricing.
2
Elastic Load Balancing User Guide
Availability Zones and load balancer nodes
You configure your load balancer to accept incoming traffic by specifying one or more listeners. A listener
is a process that checks for connection requests. It is configured with a protocol and port number for
connections from clients to the load balancer. Likewise, it is configured with a protocol and port number
for connections from the load balancer to the targets.
There is a key difference in how the load balancer types are configured. With Application Load Balancers,
Network Load Balancers, and Gateway Load Balancers, you register targets in target groups, and route
traffic to the target groups. With Classic Load Balancers, you register instances with the load balancer.
We recommend enabling multiple Availability Zones for all load balancers. With an Application Load
Balancer however, it is a requirement that you enable at least two or more Availability Zones. This
configuration helps ensure that the load balancer can continue to route traffic. If one Availability Zone
becomes unavailable or has no healthy targets, the load balancer can route traffic to the healthy targets
in another Availability Zone.
After you disable an Availability Zone, the targets in that Availability Zone remain registered with the
load balancer. However, even though they remain registered, the load balancer does not route traffic to
them.
The following diagrams demonstrate the effect of cross-zone load balancing. There are two enabled
Availability Zones, with two targets in Availability Zone A and eight targets in Availability Zone B. Clients
3
Elastic Load Balancing User Guide
Cross-zone load balancing
send requests, and Amazon Route 53 responds to each request with the IP address of one of the load
balancer nodes. This distributes traffic such that each load balancer node receives 50% of the traffic from
the clients. Each load balancer node distributes its share of the traffic across the registered targets in its
scope.
If cross-zone load balancing is enabled, each of the 10 targets receives 10% of the traffic. This is because
each load balancer node can route its 50% of the client traffic to all 10 targets.
• Each of the two targets in Availability Zone A receives 25% of the traffic.
• Each of the eight targets in Availability Zone B receives 6.25% of the traffic.
This is because each load balancer node can route its 50% of the client traffic only to targets in its
Availability Zone.
With Network Load Balancers and Gateway Load Balancers, cross-zone load balancing is disabled by
default. After you create the load balancer, you can enable or disable cross-zone load balancing at any
time.
When you create a Classic Load Balancer, the default for cross-zone load balancing depends on how you
create the load balancer. With the API or CLI, cross-zone load balancing is disabled by default. With the
AWS Management Console, the option to enable cross-zone load balancing is selected by default. After
you create a Classic Load Balancer, you can enable or disable cross-zone load balancing at any time. For
more information, see Enable cross-zone load balancing in the User Guide for Classic Load Balancers.
4
Elastic Load Balancing User Guide
Request routing
Request routing
Before a client sends a request to your load balancer, it resolves the load balancer's domain name using a
Domain Name System (DNS) server. The DNS entry is controlled by Amazon, because your load balancers
are in the amazonaws.com domain. The Amazon DNS servers return one or more IP addresses to the
client. These are the IP addresses of the load balancer nodes for your load balancer. With Network Load
Balancers, Elastic Load Balancing creates a network interface for each Availability Zone that you enable.
Each load balancer node in the Availability Zone uses this network interface to get a static IP address.
You can optionally associate one Elastic IP address with each network interface when you create the load
balancer.
As traffic to your application changes over time, Elastic Load Balancing scales your load balancer and
updates the DNS entry. The DNS entry also specifies the time-to-live (TTL) of 60 seconds. This helps
ensure that the IP addresses can be remapped quickly in response to changing traffic.
The client determines which IP address to use to send requests to the load balancer. The load balancer
node that receives the request selects a healthy registered target and sends the request to the target
using its private IP address.
Routing algorithm
With Application Load Balancers, the load balancer node that receives the request uses the following
process:
1. Evaluates the listener rules in priority order to determine which rule to apply.
2. Selects a target from the target group for the rule action, using the routing algorithm configured for
the target group. The default routing algorithm is round robin. Routing is performed independently
for each target group, even when a target is registered with multiple target groups.
With Network Load Balancers, the load balancer node that receives the connection uses the following
process:
1. Selects a target from the target group for the default rule using a flow hash algorithm. It bases the
algorithm on:
• The protocol
• The source IP address and source port
• The destination IP address and destination port
• The TCP sequence number
2. Routes each individual TCP connection to a single target for the life of the connection. The TCP
connections from a client have different source ports and sequence numbers, and can be routed to
different targets.
With Classic Load Balancers, the load balancer node that receives the request selects a registered
instance as follows:
HTTP connections
Classic Load Balancers use pre-open connections, but Application Load Balancers do not. Both Classic
Load Balancers and Application Load Balancers use connection multiplexing. This means that requests
5
Elastic Load Balancing User Guide
HTTP headers
from multiple clients on multiple front-end connections can be routed to a given target through
a single backend connection. Connection multiplexing improves latency and reduces the load on
your applications. To prevent connection multiplexing, disable HTTP keep-alives by setting the
Connection: close header in your HTTP responses.
Application Load Balancers and Classic Load Balancers support pipelined HTTP on front-end connections.
They do not support pipelined HTTP on backend connections.
Application Load Balancers support the following protocols on front-end connections: HTTP/0.9,
HTTP/1.0, HTTP/1.1, and HTTP/2. You can use HTTP/2 only with HTTPS listeners, and can send up
to 128 requests in parallel using one HTTP/2 connection. Application Load Balancers also support
connection upgrades from HTTP to WebSockets. However, if there is a connection upgrade, Application
Load Balancer listener routing rules and AWS WAF integrations no longer apply.
Application Load Balancers use HTTP/1.1 on backend connections (load balancer to registered target) by
default. However, you can use the protocol version to send the request to the targets using HTTP/2 or
gRPC. For more information, see Protocol versions. Keep-alive is supported on backend connections by
default. For HTTP/1.0 requests from clients that do not have a host header, the load balancer generates
a host header for the HTTP/1.1 requests sent on the backend connections. The host header contains the
DNS name of the load balancer.
Classic Load Balancers support the following protocols on front-end connections (client to load
balancer): HTTP/0.9, HTTP/1.0, and HTTP/1.1. They use HTTP/1.1 on backend connections (load
balancer to registered target). Keep-alive is supported on backend connections by default. For
HTTP/1.0 requests from clients that do not have a host header, the load balancer generates a host
header for the HTTP/1.1 requests sent on the backend connections. The host header contains the IP
address of the load balancer node.
HTTP headers
Application Load Balancers and Classic Load Balancers automatically add X-Forwarded-For, X-
Forwarded-Proto, and X-Forwarded-Port headers to the request.
Application Load Balancers convert the hostnames in HTTP host headers to lower case before sending
them to targets.
For front-end connections that use HTTP/2, the header names are in lowercase. Before the request
is sent to the target using HTTP/1.1, the following header names are converted to mixed case: X-
Forwarded-For, X-Forwarded-Proto, X-Forwarded-Port, Host, X-Amzn-Trace-Id, Upgrade, and
Connection. All other header names are in lowercase.
Application Load Balancers and Classic Load Balancers honor the connection header from the incoming
client request after proxying the response back to the client.
When Application Load Balancers and Classic Load Balancers receive an Expect header, they respond to
the client immediately with an HTTP 100 Continue without testing the content length header, remove
the Expect header, and then route the request.
HTTP/1.x headers
• Request line: 16 K
• Single header: 16 K
• Whole header: 64 K
6
Elastic Load Balancing User Guide
Load balancer scheme
HTTP/2 headers
• Request line: 16 K
• Single header: 16 K
• Whole header: 64 K
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.
Both internet-facing and internal load balancers route requests to your targets using private IP
addresses. Therefore, your targets do not need public IP addresses to receive requests from an internal or
an internet-facing load balancer.
If your application has multiple tiers, you can design an architecture that uses both internal and internet-
facing load balancers. For example, this is true if your application uses web servers that must be
connected to the internet, and application servers that are only connected to the web servers. Create
an internet-facing load balancer and register the web servers with it. Create an internal load balancer
and register the application servers with it. The web servers receive requests from the internet-facing
load balancer and send requests for the application servers to the internal load balancer. The application
servers receive requests from the internal load balancer.
The MTU size on an Application Load Balancer, Network Load Balancer, or Classic Load Balancer node is
not configurable. Jumbo frames (MTU 9001) are standard across all load balancer nodes. The path MTU
is the maximum packet size that is supported on the path between the originating host and the receiving
host. Path MTU Discovery (PMTUD) is used to determine the path MTU between two devices. Path MTU
Discovery is especially important if the client or target does not support jumbo frames.
When a host sends a packet that is larger than the MTU of the receiving host or larger than the MTU of
a device along the path, the receiving host or device drops the packet, and then returns the following
ICMP message: Destination Unreachable: Fragmentation Needed and Don't Fragment
was Set (Type 3, Code 4). This instructs the transmitting host to split the payload into multiple
smaller packets, and retransmit them.
If packets larger than the MTU size of the client or target interface continue to be dropped, it is likely
that Path MTU Discovery (PMTUD) is not working. To avoid this, ensure that Path MTU Discovery is
7
Elastic Load Balancing User Guide
Network MTU
working end to end, and that you have enabled jumbo frames on your clients and targets. For more
information about Path MTU Discovery and enabling jumbo frames, see Path MTU Discovery in the
Amazon EC2 User Guide.
8
Elastic Load Balancing User Guide
Create an Application Load Balancer
For demos of common load balancer configurations, see Elastic Load Balancing demos.
If you have an existing Classic Load Balancer, you can migrate to an Application Load Balancer or a
Network Load Balancer. For more information, see Migrate your Classic Load Balancer (p. 25).
Contents
• Create an Application Load Balancer (p. 9)
• Create a Network Load Balancer (p. 9)
• Create a Gateway Load Balancer (p. 9)
• Create a Classic Load Balancer (p. 9)
To create an Application Load Balancer using the AWS CLI, see Create an Application Load Balancer using
the AWS CLI in the User Guide for Application Load Balancers.
To create a Network Load Balancer using the AWS CLI, see Create a Network Load Balancer using the
AWS CLI in the User Guide for Network Load Balancers.
To create a Gateway Load Balancer using the AWS CLI, see Getting started with Gateway Load Balancers
using the AWS CLI in the User Guide for Gateway Load Balancers.
9
Elastic Load Balancing User Guide
Data protection
Security is a shared responsibility between AWS and you. The shared responsibility model describes this
as security of the cloud and security in the cloud:
• Security of the cloud – AWS is responsible for protecting the infrastructure that runs AWS services in
the AWS Cloud. AWS also provides you with services that you can use securely. Third-party auditors
regularly test and verify the effectiveness of our security as part of the AWS compliance programs. To
learn about the compliance programs that apply to Elastic Load Balancing, see AWS services in scope
by compliance program.
• Security in the cloud – Your responsibility is determined by the AWS service that you use. You are also
responsible for other factors including the sensitivity of your data, your company's requirements, and
applicable laws and regulations.
This documentation helps you understand how to apply the shared responsibility model when using
Elastic Load Balancing. It shows you how to configure Elastic Load Balancing to meet your security and
compliance objectives. You also learn how to use other AWS services that help you to monitor and secure
your Elastic Load Balancing resources.
With a Gateway Load Balancer, you are responsible for choosing and qualifying software from appliance
vendors. You must trust the appliance software to inspect or modify traffic from the load balancer,
which operates at the layer 3 of the Open Systems Interconnection (OSI) model, the network layer. The
appliance vendors listed as Elastic Load Balancing Partners have integrated and qualified their appliance
software with AWS. You can place a higher degree of trust in the appliance software from vendors in this
list. However, AWS does not guarantee the security or reliability of software from these vendors.
Contents
• Data protection in Elastic Load Balancing (p. 10)
• Identity and access management for Elastic Load Balancing (p. 11)
• Compliance validation for Elastic Load Balancing (p. 21)
• Resilience in Elastic Load Balancing (p. 21)
• Infrastructure security in Elastic Load Balancing (p. 22)
• Elastic Load Balancing and interface VPC endpoints (p. 23)
For data protection purposes, we recommend that you protect AWS account credentials and set up
individual user accounts with AWS Identity and Access Management (IAM). That way each user is given
only the permissions necessary to fulfill their job duties. We also recommend that you secure your data
in the following ways:
10
Elastic Load Balancing User Guide
Encryption at rest
We strongly recommend that you never put sensitive identifying information, such as your customers'
account numbers, into free-form fields such as a Name field. This includes when you work with Elastic
Load Balancing or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any data that
you enter into Elastic Load Balancing or other services might get picked up for inclusion in diagnostic
logs. When you provide a URL to an external server, don't include credentials information in the URL to
validate your request to that server.
Encryption at rest
If you enable server-side encryption with Amazon S3-managed encryption keys (SSE-S3) for your S3
bucket for Elastic Load Balancing access logs, Elastic Load Balancing automatically encrypts each access
log file before it is stored in your S3 bucket. Elastic Load Balancing also decrypts the access log files
when you access them. Each log file is encrypted with a unique key, which is itself encrypted with a
master key that is regularly rotated.
Encryption in transit
Elastic Load Balancing simplifies the process of building secure web applications by terminating HTTPS
and TLS traffic from clients at the load balancer. The load balancer performs the work of encrypting and
decrypting the traffic, instead of requiring each EC2 instance to handle the work for TLS termination.
When you configure a secure listener, you specify the cipher suites and protocol versions that are
supported by your application, and a server certificate to install on your load balancer. You can use
AWS Certificate Manager (ACM) or AWS Identity and Access Management (IAM) to manage your server
certificates. Application Load Balancers support HTTPS listeners. Network Load Balancers support TLS
listeners. Classic Load Balancers support both HTTPS and TLS listeners.
By default, IAM users don't have permission to create, view, or modify AWS resources. To allow an IAM
user to access resources such as a load balancer, and to perform tasks, you:
1. Create an IAM policy that grants the IAM user permission to use the specific resources and API actions
they need.
2. Attach the policy to the IAM user or the group that the IAM user belongs to.
11
Elastic Load Balancing User Guide
Grant permissions using IAM policies
When you attach a policy to a user or group of users, it allows or denies the users permission to perform
the specified tasks on the specified resources.
For example, you can use IAM to create users and groups under your AWS account. An IAM user can be
a person, a system, or an application. Then you grant permissions to the users and groups to perform
specific actions on the specified resources using an IAM policy.
An IAM policy is a JSON document that consists of one or more statements. Each statement is structured
as shown in the following example.
{
"Version": "2012-10-17",
"Statement":[{
"Effect": "effect",
"Action": "action",
"Resource": "resource-arn",
"Condition": {
"condition": {
"key":"value"
}
}
}]
}
• Effect— The effect can be Allow or Deny. By default, IAM users don't have permission to use resources
and API actions, so all requests are denied. An explicit allow overrides the default. An explicit deny
overrides any allows.
• Action— The action is the specific API action for which you are granting or denying permission. For
more information about specifying action, see API actions for Elastic Load Balancing (p. 12).
• Resource— The resource that's affected by the action. With many Elastic Load Balancing API actions,
you can restrict the permissions granted or denied to a specific load balancer. To do so, specify its
Amazon Resource Name (ARN) in this statement. Otherwise, you can use the * wildcard to specify all of
your load balancers. For more information, see Elastic Load Balancing resources (p. 13).
• Condition— You can optionally use conditions to control when your policy is in effect. For more
information, see Condition keys for Elastic Load Balancing (p. 16).
"Action": "elasticloadbalancing:DescribeLoadBalancers"
To specify multiple actions in a single statement, enclose them in square brackets and separate them
with a comma, as shown in the following example.
"Action": [
"elasticloadbalancing:DescribeLoadBalancers",
12
Elastic Load Balancing User Guide
Elastic Load Balancing resources
"elasticloadbalancing:DeleteLoadBalancer"
]
You can also specify multiple actions using the * wildcard. The following example specifies all API action
names for Elastic Load Balancing that start with Describe.
"Action": "elasticloadbalancing:Describe*"
To specify all API actions for Elastic Load Balancing, use the * wildcard, as shown in the following
example.
"Action": "elasticloadbalancing:*"
For the complete list of the API actions for Elastic Load Balancing, see the following documentation:
• Application Load Balancers and Network Load Balancers — API Reference version 2015-12-01
• Classic Load Balancers — API Reference version 2012-06-01
The ARN for an Application Load Balancer has the format shown in the following example.
arn:aws:elasticloadbalancing:region-code:account-id:loadbalancer/app/load-balancer-
name/load-balancer-id
The ARN for a Network Load Balancer has the format shown in the following example.
arn:aws:elasticloadbalancing:region-code:account-id:loadbalancer/net/load-balancer-
name/load-balancer-id
The ARN for a Classic Load Balancer has the format shown in the following example.
arn:aws:elasticloadbalancing:region-code:account-id:loadbalancer/load-balancer-name
The ARNs for a listener and a listener rule for an Application Load Balancer have the format shown in the
following example.
arn:aws:elasticloadbalancing:region-code:account-id:listener/app/load-balancer-name/load-
balancer-id/listener-id
arn:aws:elasticloadbalancing:region-code:account-id:listener-rule/app/load-balancer-
name/load-balancer-id/listener-id/rule-id
The ARN for a listener for a Network Load Balancer has the format shown in the following example.
arn:aws:elasticloadbalancing:region-code:account-id:listener/net/load-balancer-name/load-
balancer-id/listener-id
13
Elastic Load Balancing User Guide
Resource-level permissions for Elastic Load Balancing
The ARN for a target group has the format shown in the following example.
arn:aws:elasticloadbalancing:region-code:account-id:targetgroup/target-group-name/target-
group-id
For API actions that don't support resource-level permissions, you must specify the resource statement
shown in the following example.
"Resource": "*"
AddListenerCertificates listener
CreateRule listener
14
Elastic Load Balancing User Guide
Resource-level permissions for Elastic Load Balancing
DeleteListener listener
ModifyListener listener
RemoveListenerCertificates listener
15
Elastic Load Balancing User Guide
Condition keys for Elastic Load Balancing
You cannot use the aws:SourceIp condition key with Elastic Load Balancing.
• AddTags
• CreateListener
• CreateLoadBalancer
• DeleteLoadBalancer
• DeleteTargetGroup
• DeregisterTargets
• ModifyLoadBalancerAttributes
• ModifyTargetGroup
• ModifyTargetGroupAttributes
• RegisterTargets
• RemoveTags
• SetIpAddressType
• SetSecurityGroups
• SetSubnets
16
Elastic Load Balancing User Guide
Predefined AWS managed policies
• AddTags
• ApplySecurityGroupsToLoadBalancer
• AttachLoadBalancersToSubnets
• ConfigureHealthCheck
• CreateAppCookieStickinessPolicy
• CreateLBCookieStickinessPolicy
• CreateLoadBalancer
• CreateLoadBalancerListeners
• CreateLoadBalancerPolicy
• DeleteLoadBalancer
• DeleteLoadBalancerListeners
• DeleteLoadBalancerPolicy
• DeregisterInstancesFromLoadBalancer
• DetachLoadBalancersFromSubnets
• DisableAvailabilityZonesForLoadBalancer
• EnableAvailabilityZonesForLoadBalancer
• ModifyLoadBalancerAttributes
• RegisterInstancesWithLoadBalancer
• RemoveTags
• SetLoadBalancerListenerSSLCertificate
• SetLoadBalancerPoliciesForBackendServer
• SetLoadBalancerPoliciesOfListener
For more information about global condition keys, see AWS global condition context keys in the IAM User
Guide.
The following actions support the aws:RequestTag/key and aws:TagKeys condition keys:
• AddTags
• CreateLoadBalancer
• RemoveTags
• ElasticLoadBalancingFullAccess — Grants full access required to use Elastic Load Balancing features.
• ElasticLoadBalancingReadOnly — Grants read-only access to Elastic Load Balancing features.
For more information about the permissions required by each Elastic Load Balancing action, see Elastic
Load Balancing API permissions (p. 18).
17
Elastic Load Balancing User Guide
API permissions
CreateLoadBalancer
• elasticloadbalancing:CreateLoadBalancer
• ec2:DescribeAccountAttributes
• ec2:DescribeAddresses
• ec2:DescribeInternetGateways
• ec2:DescribeSecurityGroups
• ec2:DescribeSubnets
• ec2:DescribeVpcs
• iam:CreateServiceLinkedRole
CreateTargetGroup
• elasticloadbalancing:CreateTargetGroup
• ec2:DescribeInternetGateways
• ec2:DescribeVpcs
RegisterTargets
• elasticloadbalancing:RegisterTargets
• ec2:DescribeInstances
• ec2:DescribeInternetGateways
• ec2:DescribeSubnets
• ec2:DescribeVpcs
SetIpAddressType
• elasticloadbalancing:SetIpAddressType
• ec2:DescribeSubnets
SetSubnets
• elasticloadbalancing:SetSubnets
• ec2:DescribeSubnets
ApplySecurityGroupsToLoadBalancer
• elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
• ec2:DescribeAccountAttributes
• ec2:DescribeSecurityGroups
18
Elastic Load Balancing User Guide
Service-linked role
AttachLoadBalancerToSubnets
• elasticloadbalancing:AttachLoadBalancerToSubnets
• ec2:DescribeSubnets
CreateLoadBalancer
• elasticloadbalancing:CreateLoadBalancer
• ec2:CreateSecurityGroup
• ec2:DescribeAccountAttributes
• ec2:DescribeInternetGateways
• ec2:DescribeSecurityGroups
• ec2:DescribeSubnets
• ec2:DescribeVpcs
• iam:CreateServiceLinkedRole
DeregisterInstancesFromLoadBalancer
• elasticloadbalancing:DeregisterInstancesFromLoadBalancer
• ec2:DescribeClassicLinkInstances
• ec2:DescribeInstances
DescribeInstanceHealth
• elasticloadbalancing:DescribeInstanceHealth
• ec2:DescribeClassicLinkInstances
• ec2:DescribeInstances
DescribeLoadBalancers
• elasticloadbalancing:DescribeLoadBalancers
• ec2:DescribeSecurityGroups
DisableAvailabilityZonesForLoadBalancer
• elasticloadbalancing:DisableAvailabilityZonesForLoadBalancer
• ec2:DescribeAccountAttributes
• ec2:DescribeInternetGateways
• ec2:DescribeVpcs
EnableAvailabilityZonesForLoadBalancer
• elasticloadbalancing:EnableAvailabilityZonesForLoadBalancer
• ec2:DescribeAccountAttributes
• ec2:DescribeInternetGateways
• ec2:DescribeSubnets
• ec2:DescribeVpcs
RegisterInstancesWithLoadBalancer
• elasticloadbalancing:RegisterInstancesWithLoadBalancer
• ec2:DescribeAccountAttributes
• ec2:DescribeClassicLinkInstances
• ec2:DescribeInstances
• ec2:DescribeVpcClassicLink
19
Elastic Load Balancing User Guide
Service-linked role
• ec2:DescribeAddresses
• ec2:DescribeInstances
• ec2:DescribeNetworkInterfaces
• ec2:DescribeSubnets
• ec2:DescribeSecurityGroups
• ec2:DescribeVpcs
• ec2:DescribeInternetGateways
• ec2:DescribeAccountAttributes
• ec2:DescribeClassicLinkInstances
• ec2:DescribeVpcClassicLink
• ec2:CreateSecurityGroup
• ec2:CreateNetworkInterface
• ec2:DeleteNetworkInterface
• ec2:ModifyNetworkInterfaceAttribute
• ec2:AuthorizeSecurityGroupIngress
• ec2:AssociateAddress
• ec2:DisassociateAddress
• ec2:AttachNetworkInterface
• ec2:DetachNetworkInterface
• ec2:AssignPrivateIpAddresses
• ec2:AssignIpv6Addresses
• ec2:UnassignIpv6Addresses
• logs:CreateLogDelivery
• logs:GetLogDelivery
• logs:UpdateLogDelivery
• logs:DeleteLogDelivery
• logs:ListLogDeliveries
For Elastic Load Balancing to create a service-linked role on your behalf, you must have the required
permissions. For more information, see Service-linked role permissions in the IAM User Guide.
If you created a load balancer before January 11, 2018, Elastic Load Balancing created
AWSServiceRoleForElasticLoadBalancing in your AWS account. For more information, see A new role
appeared in my AWS account in the IAM User Guide.
20
Elastic Load Balancing User Guide
Compliance validation
You can delete this service-linked role only after you delete all load balancers in your AWS account.
This ensures that you can't inadvertently remove permission to access your load balancers. For more
information, see Delete an Application Load Balancer, Delete a Network Load Balancer, and Delete a
Classic Load Balancer.
You can use the IAM console, the IAM CLI, or the IAM API to delete service-linked roles. For more
information, see Deleting a service-linked role in the IAM User Guide.
After you delete AWSServiceRoleForElasticLoadBalancing, Elastic Load Balancing creates the role again
if you create a load balancer.
For a list of AWS services in scope of specific compliance programs, see AWS services in scope by
compliance program. For general information, see AWS compliance programs.
You can download third-party audit reports using AWS Artifact. For more information, see Downloading
reports in AWS Artifact.
Your compliance responsibility when using Elastic Load Balancing is determined by the sensitivity of
your data, your company's compliance objectives, and applicable laws and regulations. AWS provides the
following resources to help with compliance:
• Security and compliance quick start guides – These deployment guides discuss architectural
considerations and provide steps for deploying security- and compliance-focused baseline
environments on AWS.
• Architecting for HIPAA security and compliance whitepaper – This whitepaper describes how
companies can use AWS to create HIPAA-compliant applications.
• AWS compliance resources – This collection of workbooks and guides might apply to your industry and
location.
• Evaluating resources with rules in the AWS Config Developer Guide – AWS Config; assesses how well
your resource configurations comply with internal practices, industry guidelines, and regulations.
• AWS Security Hub – This AWS service provides a comprehensive view of your security state within AWS
that helps you check your compliance with security industry standards and best practices.
21
Elastic Load Balancing User Guide
Infrastructure security
applications and databases that automatically fail over between zones without interruption. Availability
Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data
center infrastructures.
For more information about AWS Regions and Availability Zones, see AWS Global Infrastructure.
In addition to the AWS Global Infrastructure, Elastic Load Balancing provides the following features to
support your data resiliency:
• Distributes incoming traffic across multiple instances in a single Availability Zone or multiple
Availability Zones.
• You can use AWS Global Accelerator with your Application Load Balancers to distribute incoming traffic
across multiple load balancers in one or more AWS Regions. For more information, see the AWS Global
Accelerator Developer Guide.
• Amazon ECS enables you to run, stop, and manage Docker containers on a cluster of EC2 instances.
You can configure your Amazon ECS service to use a load balancer to distribute incoming traffic across
the services in a cluster. For more information, see the Amazon Elastic Container Service Developer
Guide.
You use AWS published API calls to access Elastic Load Balancing through the network. Clients must
support Transport Layer Security (TLS) 1.0 or later. We recommend TLS 1.2 or later. Clients must also
support cipher suites with perfect forward secrecy (PFS) such as Ephemeral Diffie-Hellman (DHE) or
Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems such as Java 7 and later support
these modes.
Additionally, requests must be signed using an access key ID and a secret access key that is associated
with an IAM principal. Or you can use the AWS Security Token Service (AWS STS) to generate temporary
security credentials to sign requests.
Network isolation
A virtual private cloud (VPC) is a virtual network in your own logically isolated area in the AWS Cloud.
A subnet is a range of IP addresses in a VPC. When you create a load balancer, you can specify one or
more subnets for the load balancer nodes. You can deploy EC2 instances in the subnets of your VPC and
register them with your load balancer. For more information about VPC and subnets, see the Amazon
VPC User Guide.
When you create a load balancer in a VPC, it can be either internet-facing or internal. An internal load
balancer can only route requests that come from clients with access to the VPC for the load balancer.
Your load balancer sends requests to its registered targets using private IP addresses. Therefore, your
targets do not need public IP addresses in order to receive requests from a load balancer.
To call the Elastic Load Balancing API from your VPC without sending traffic over the public
internet, use AWS PrivateLink. For more information, see Elastic Load Balancing and interface VPC
endpoints (p. 23).
22
Elastic Load Balancing User Guide
Interface VPC endpoints
the Open Systems Interconnection (OSI) model. Network Load Balancers operate at the connection level
(layer 4) of the OSI model. Classic Load Balancers operate at both the request and connection levels.
Consider the following options for securing network traffic when you use a load balancer:
• Use secure listeners to support encrypted communication between clients and your load balancers.
Application Load Balancers support HTTPS listeners. Network Load Balancers support TLS listeners.
Classic Load Balancers support both HTTPS and TLS listeners. You can choose from predefined security
policies for your load balancer to specify the cipher suites and protocol versions that are supported by
your application. You can use AWS Certificate Manager (ACM) or AWS Identity and Access Management
(IAM) to manage the server certificates installed on your load balancer. You can use the Server
Name Indication (SNI) protocol to serve multiple secure websites using a single secure listener. SNI is
automatically enabled for your load balancer when you associate more than one server certificate with
a secure listener.
• Configure the security groups for your Application Load Balancers and Classic Load Balancers to accept
traffic only from specific clients. These security groups must allow inbound traffic from clients on the
listener ports and outbound traffic to the clients.
• Configure the security groups for your Amazon EC2 instances to accept traffic only from the load
balancer. These security groups must allow inbound traffic from the load balancer on the listener ports
and the health check ports.
• Configure your Application Load Balancer to securely authenticate users through an identity provider
or using corporate identities. For more information, see Authenticate users using an Application Load
Balancer.
• Use AWS WAF with your Application Load Balancers to allow or block requests based on the rules in a
web access control list (web ACL).
Interface VPC endpoints are powered by AWS PrivateLink, a feature that enables private communication
between AWS services using private IP addresses. For more information, see AWS PrivateLink.
Limit
AWS PrivateLink does not support a Network Load Balancer with more than 50 listeners.
com.amazonaws.region.elasticloadbalancing
For more information, see Creating an interface endpoint in the Amazon VPC User Guide.
23
Elastic Load Balancing User Guide
Create a VPC endpoint policy for Elastic Load Balancing
The following example shows a VPC endpoint policy that denies everyone permission to create a load
balancer through the endpoint. The example policy also grants everyone permission to perform all other
actions.
{
"Statement": [
{
"Action": "*",
"Effect": "Allow",
"Resource": "*",
"Principal": "*"
},
{
"Action": "elasticloadbalancing:CreateLoadBalancer",
"Effect": "Deny",
"Resource": "*",
"Principal": "*"
}
]
}
For more information, see Using VPC endpoint policies in the Amazon VPC User Guide.
24
Elastic Load Balancing User Guide
Step 1: Create a new load balancer
Migration scenarios
1. If you have an existing Classic Load Balancer in a VPC, verify that an Application Load Balancer or
Network Load Balancer meets your needs and then migrate your Classic Load Balancer to one of these
load balancer types.
2. If you have an existing Classic Load Balancer in EC2-Classic, verify that an Application Load Balancer
or Network Load Balancer meets your need and then migrate your Classic Load Balancer to one of
these load balancer types. Otherwise, migrate to a Classic Load Balancer in a VPC. You can leave your
instances in EC2-Classic and enable ClassicLink to link the instances to the load balancer VPC, or you
can migrate your instances from EC2-Classic to a VPC.
Migration Process
• Step 1: Create a new load balancer (p. 25)
• Step 2: Gradually redirect traffic to your new load balancer (p. 28)
• Step 3: Update policies, scripts, and code (p. 28)
• Step 4: Delete the old load balancer (p. 29)
To create an Application Load Balancer or Network Load Balancer to replace a Classic Load Balancer in a
VPC, use one of the following options:
To create a Classic Load Balancer in a VPC to replace a Classic Load Balancer in EC2-Classic, use the
following option:
25
Elastic Load Balancing User Guide
Option 2: Use the load balancer copy utility from github
26
Elastic Load Balancing User Guide
Option 3: Migrate manually to an Application
Load Balancer or Network Load Balancer
1. Create a new load balancer, with the same scheme (internet-facing or internal), subnets, and security
groups as the Classic Load Balancer.
2. Create one target group for your load balancer, with the same health check settings that you have for
your Classic Load Balancer.
3. Do one of the following:
• If your Classic Load Balancer is attached to an Auto Scaling group, attach your target group to the
Auto Scaling group. This also registers the Auto Scaling instances with the target group.
• Register your EC2 instances with your target group.
4. Create one or more listeners, each with a default rule that forwards requests to the target group. If
you create an HTTPS listener, you can specify the same certificate that you specified for your Classic
Load Balancer. We recommend that you use the default security policy.
5. If your Classic Load Balancer has tags, review them and add the relevant tags to your new load
balancer.
27
Elastic Load Balancing User Guide
Step 2: Gradually redirect traffic to your new load balancer
1. Paste the DNS name of your new load balancer into the address field of an internet-connected web
browser. If everything is working, the browser displays the default page of your application.
2. Create a new DNS record that associates your domain name with your new load balancer. If your
DNS service supports weighting, specify a weight of 1 in the new DNS record and a weight of 9 in
the existing DNS record for your old load balancer. This directs 10% of the traffic to the new load
balancer and 90% of the traffic to the old load balancer.
3. Monitor your new load balancer to verify that it is receiving traffic and routing requests to your
instances.
Important
The time-to-live (TTL) in the DNS record is 60 seconds. This means that any DNS server that
resolves your domain name keeps the record information in its cache for 60 seconds, while
the changes propagate. Therefore, these DNS servers can still route traffic to your old load
balancer for up to 60 seconds after you complete the previous step. During propagation,
traffic could be directed to either load balancer.
4. Continue to update the weight of your DNS records until all traffic is directed to your new load
balancer. When you are finished, you can delete the DNS record for your old load balancer.
• Update IAM policies that use API version 2012-06-01 to use version 2015-12-01.
• Update processes that use CloudWatch metrics in the AWS/ELB namespace to use metrics from the
AWS/ApplicationELB or AWS/NetworkELB namespace.
• Update scripts that use aws elb AWS CLI commands to use aws elbv2 AWS CLI commands.
• Update AWS CloudFormation templates that use the
AWS::ElasticLoadBalancing::LoadBalancer resource to use the
AWS::ElasticLoadBalancingV2 resources.
• Update code that uses Elastic Load Balancing API version 2012-06-01 to use version 2015-12-01.
Resources
28
Elastic Load Balancing User Guide
Step 4: Delete the old load balancer
• You have redirected all traffic from the old load balancer to the new load balancer.
• All existing requests that were routed to the old load balancer have completed.
29