Elastic Load Balancing is an AWS service that distributes incoming application or network traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, in multiple Availability Zones. Elastic Load Balancing scales customers’ load balancer as traffic to their application changes over time. It can automatically scale to the vast majority of workloads.
- Elastic Load Balancing offers three types of load balancers that all feature the high availability, automatic scaling, and robust security necessary to make applications fault tolerant.
- To load balance HTTP requests use Application Load Balancer.
- For network/transport protocols (layer4 – TCP, UDP) load balancing, and for extreme performance/low latency applications using Network Load Balancer is the best option.
- If the application is built within the EC2 Classic network then using Classic Load Balancer is recommended by AWS.
- Privately access Elastic Load Balancing APIs from customers Amazon VPC can be accessed by creating VPC endpoints. With VPC endpoints, the routing between the VPC and Elastic Load Balancing APIs is handled by the AWS network without the need for an Internet gateway, NAT gateway, or VPN connection.
- An Application Load Balancer is integrated with AWS Certificate Management (ACM). Which makes it very simple to bind a certificate to the load balancer thereby making the entire SSL offload process very easy.
Elastic Load Balancing automatically distributes incoming traffic across multiple targets including Amazon EC2 instances, containers, IP addresses, and Lambda functions in multiple Availability Zones.
- Elastic Load Balancing can also load balance across a Region, routing traffic to healthy targets in different Availability Zones.
- The Amazon Elastic Load Balancing Service Level Agreement commitment is 99.99% availability for a load balancer
Elastic Load Balancing allows customers to monitor their applications and its performance in real time with Amazon CloudWatch metrics, logging, and request tracing.
- This improves visibility into the behavior of their applications, uncovering issues and identifying performance bottlenecks in the application stack at the granularity of an individual request.
- Elastic Load Balancing can detect unhealthy targets, stop sending traffic to them, and then spread the load across the remaining healthy targets.
Elastic Load Balancing also allows customers to use IP addresses to route requests to application targets. Which offers customers flexibility in how they virtualize their application targets.
- It enables customers to host more applications on the same instance
- This enables the applications to have individual security groups and use the same network port to further simplify inter-application communication in microservice-based architecture.
Elastic Load Balancing works with Amazon VPC to provide robust security features, that includes integrated certificate management and SSL/TLS decryption, which allows customers the flexibility to centrally manage the SSL settings of the load balancer and offload CPU intensive work from your application.
- Together, they give AWS customers the flexibility to centrally manage TLS settings and offload CPU intensive workloads from their applications.
- Using Amazon VPC to create and manage security groups associated with load balancers to provide additional networking and security options.
- Customers can create an internal (non-internet-facing) load balancer.
- Customers can load balance HTTP/HTTPS applications for layer 7-specific features, or use strict layer 4 load balancing for applications that rely on the TCP and UDP protocols.
Elastic Load Balancing is capable of handling rapid changes in network traffic patterns. Additionally, deep integration with Auto Scaling ensures sufficient application capacity to meet varying levels of application load without requiring manual intervention.
- Elastic Load Balancing provides integration with Amazon CloudWatch metrics and request tracing in order to monitor performance of customers applications in real time.
Elastic Load Balancing offers ability to load balance across AWS and on-premises resources using the same load balancer.
- This makes it easy for customers to migrate, burst, or failover on-premises applications to the cloud.
ELB AWS 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.
- 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.
- 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.
- 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..
- 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.
- 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.
- 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).
Types of load Balancer
Elastic Load Balancing supports three types of load balancers.There is a key difference in how the load balancer types are configured. With Application Load Balancers and Network 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.
Network Load Balancers
Network Load Balancer operates at the connection level (Layer 4), routing connections to targets – Amazon EC2 instances, microservices, and containers – within Amazon Virtual Private Cloud (Amazon VPC) based on IP protocol data. Ideal for load balancing of both TCP and UDP traffic, Network Load Balancer is capable of handling millions of requests per second while maintaining ultra-low latencies. Network Load Balancer is optimized to handle sudden and volatile traffic patterns while using a single static IP address per Availability Zone. It is integrated with other popular AWS services such as Auto Scaling, Amazon EC2 Container Service (ECS), Amazon CloudFormation and AWS Certificate Manager (ACM).
- Network Load Balancer is best suited for load balancing of Transmission Control Protocol (TCP), User Datagram Protocol (UDP) and Transport Layer Security (TLS) traffic where extreme performance is required. Operating at the connection level (Layer 4), Network Load Balancer routes traffic to targets within Amazon Virtual Private Cloud (Amazon VPC) and is capable of handling millions of requests per second while maintaining ultra-low latencies. Network Load Balancer is also
Application Load Balancers
Application Load Balancer operates at the request level (layer 7), routing traffic to targets – EC2 instances, containers, IP addresses and Lambda functions based on the content of the request. Ideal for advanced load balancing of HTTP and HTTPS traffic, Application Load Balancer provides advanced request routing targeted at delivery of modern application architectures, including microservices and container-based applications. Application Load Balancer simplifies and improves the security of your application, by ensuring that the latest SSL/TLS ciphers and protocols are used at all times.
- Application Load Balancer is best suited for load balancing of HTTP and HTTPS traffic and provides advanced request routing targeted at the delivery of modern application architectures, including microservices and containers. Operating at the individual request level (Layer 7), Application Load Balancer routes traffic to targets within Amazon Virtual Private Cloud (Amazon VPC) based on the content of the request.
Classic Load Balancers
Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances and operates at both the request level and connection level. Classic Load Balancer is intended for applications that were built within the EC2-Classic network. We recommend Application Load Balancer for Layer 7 and Network Load Balancer for Layer 4 when using Virtual Private Cloud (VPC).
- Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances and operates at both the request level and connection level. Classic Load Balancer is intended for applications that were built within the EC2-Classic network.
Amazon ELB Integration
When pulling these concepts together to build an application that is highly available and resilient to failures, consider these building blocks:
- In every AWS region, an Elastic Load Balancing load balancer is set up with cross-zone load balancing and connection draining. This distributes the load evenly across all instances in all Availability Zones, and it ensures requests in flight are fully served before an Amazon EC2 instance is disconnected from an Elastic Load Balancing load balancer for any reason.
- Each Elastic Load Balancing load balancer delegates requests to Amazon EC2 instances running in multiple Availability Zones in an auto-scaling group. This protects the application from Availability Zone outages, ensures that a minimal amount of instances is always running, and responds to changes in load by properly scaling each group’s Amazon EC2 instances.
- Each Elastic Load Balancing load balancer has health checks defined to ensure that it delegates requests only to healthy instances. Each Elastic Load Balancing load balancer also has an Amazon Route 53 health check associated with it to ensure that requests are routed only to load balancers that have healthy Amazon EC2 instances.
- The application’s production environment (for example, prod.domain.com) has Amazon Route 53 alias records that point to Elastic Load Balancing load balancers. The production environment also uses a latency-based routing policy that is associated with Elastic Load Balancing health checks. This ensures that requests are routed to a healthy load balancer, thereby providing minimal latency to a client.
- The application’s failover environment (for example, fail.domain.com) has an Amazon Route 53 alias record that points to an Amazon CloudFront distribution of an Amazon S3 bucket hosting a static version of the application.
- The application’s subdomain (for example, www.domain.com) has an Amazon Route 53 alias record that points to prod.domain.com (as primary target) and fail.domain .com (as secondary target) using a failover routing policy. This ensures www.domain.com routes to the production load balancers if at least one of them is healthy or the “fail whale” if all of them appear to be unhealthy.
- The application’s hosted zone (for example, domain.com) has an Amazon Route 53 alias record that redirects requests to www.domain.com using an Amazon S3 bucket of the same name.
- Application content (both static and dynamic) can be served using Amazon CloudFront. This ensures that the content is delivered to clients from Amazon CloudFront edge locations spread all over the world to provide minimal latency. Serving dynamic content from a Content Delivery Network (CDN), where it is cached for short periods of time (that is, several seconds), takes the load off of the application and further improves its latency and responsiveness.
- The application is deployed in multiple AWS regions, protecting it from a regional outage.
Each listener contains a default rule, and one listener contains another rule that routes requests to a different target group. One target is registered with two target groups.
Registering a Damian
To use a domain name such as example.com, you need to find a domain name that isn’t already in use by someone else and register it. When you register a domain name, you reserve it for your exclusive use everywhere on the internet, typically for one year. By default, we automatically renew your domain name at the end of each year, but you can disable automatic renewal. This Getting Started tutorial shows you how to perform the following tasks:
- Register a domain name, such as example.com
- Create an Amazon S3 bucket and configure it to host a website
- Create a sample website and save the file in your S3 bucket
- Configure Amazon Route 53 to route traffic to your new website