Skip to main content

Directing Traffic with Elastic Load Balancing

 




Directing traffic with Elastic Load Balancing (ELB) in AWS is fundamental for distributing incoming network requests across multiple Amazon EC2 instances or other AWS resources. ELB helps ensure high availability, fault tolerance, and efficient application resource utilization. Here's a step-by-step overview of how traffic is directed with ELB:

  1. Create an Elastic Load Balancer:

    • In the AWS Management Console, navigate to the EC2 dashboard.

    • Choose "Load Balancers" and click "Create Load Balancer."

    • Select the type of load balancer you need:

      • Application Load Balancer (ALB): For routing HTTP/HTTPS traffic at the application layer.

      • Network Load Balancer (NLB): For handling TCP, UDP, and TLS traffic at the transport layer.

      • Classic Load Balancer (deprecated): An older version of ELB with fewer features; it's recommended to use ALB or NLB if possible.

    • Configure the load balancer settings, such as listeners (ports), security groups, and VPC settings.

  2. Define Target Groups:

    • For ALB and NLB, you must create target groups to specify how the incoming traffic should be routed. Target groups are associated with instances or resources that you want to load balance.

    • Configure health checks in the target groups to monitor the health of the registered resources.

  3. Set Up Listener Rules:

    • For ALB, you can define listener rules to route traffic based on various conditions, such as URL paths, host headers, and query parameters. This allows you to send requests to different target groups based on the content of the request.

    • For NLB, you can specify routing rules based on the protocol, port, or IP address.

  4. Register Instances or Resources:

    • Associate your EC2 instances or other resources with the target groups.

    • These instances or resources will receive traffic according to the rules and conditions you've defined in the target groups.

  5. Route Traffic:

    • Traffic is directed to the load balancer's DNS name or IP address. Clients connect to the load balancer, which routes requests to the registered instances or resources based on the defined rules.

  6. Health Checks and Auto Scaling:

    • ELB continuously performs health checks on registered instances or resources. Unhealthy instances are automatically taken out of rotation.

    • You can combine ELB with AWS Auto Scaling to dynamically adjust the number of instances based on traffic load, ensuring high availability and optimal resource utilization.

  7. Monitoring and Scaling:

    • Utilize AWS CloudWatch to monitor the performance of your load balancer and set up alarms to notify you of any issues.

    • Scaling can be automated based on CloudWatch metrics and alarms.

  8. SSL/TLS Termination (For ALB):

    • ALB can terminate SSL/TLS connections, offloading the decryption process from your instances.

  9. Sticky Sessions:

    • If required, you can enable sticky sessions to ensure that a user's requests are consistently routed to the same instance.

  10. Failover and Redundancy:

    • For high availability, deploy multiple load balancers in different Availability Zones.

Using Elastic Load Balancing is a best practice for deploying applications in AWS to ensure reliability, fault tolerance, and scalability. The specific configuration details and best practices may vary depending on your application's needs and the type of ELB you choose.

Example: Elastic Load Balancing

Low-demand period

ELB pointing to two EC2 instances in an Auto Scaling group.


















Here's an example of how Elastic Load Balancing works. Suppose a few customers have come to the coffee shop and are ready to place their orders. 

If only a few registers are open, this matches the demand of customers who need service. The coffee shop is less likely to have available registers with no customers. In this example, you can think of the registers as Amazon EC2 instances.


High-demand period

Elastic Load Balancing during a high-demand period.














Throughout the day, as the number of customers increases, the coffee shop opens more registers to accommodate them. 

Additionally, a coffee shop employee directs customers to the most appropriate register to evenly distribute the number of requests across the open registers. You can think of this coffee shop employee as a load balancer. 

Comments

Popular posts from this blog

Run command

"Use Run Command make life easy" Sometime we use many run command in our windows base computer. Run command is very useful for easy work. There are some "run command",

Cloud computing

  Cloud computing is a technology model that enables access to a shared pool of computing resources and services over the Internet. Instead of owning and maintaining physical servers and data centers, organizations can use cloud computing services provided by cloud service providers. These services include computing power, storage, databases, networking, software, and more. Cloud computing services can be categorized into several main models: Infrastructure as a Service (IaaS): IaaS provides virtualized computing resources over the Internet. Users can rent virtual machines, storage, and networking components, allowing them to run and manage their operating systems and applications. Platform as a Service (PaaS): PaaS offers a platform that includes the underlying infrastructure, development tools, and services to build, deploy, and manage applications. Users focus on coding and application development while the platform handles the underlying infrastructure. Software as a Service ...

AWS Free Tier

The AWS Free Tier is designed to give you hands-on experience with a range of Amazon Web Services (AWS) products and services without charging you for usage up to a specific limit. This tier primarily benefits new AWS customers, allowing them to try different AWS services and gain practical experience before committing to more extensive usage. The Free Tier includes offers that are available for 12 months following your AWS sign-up date, as well as offers that are always free. Here are the main components of the AWS Free Tier: 12-Months Free: These offers are available to new AWS customers and are valid for 12 months following your AWS sign-up date. After the 12-month free usage term, you pay standard, pay-as-you-go service rates. Always Free: These offers do not expire and are available to all AWS customers. They provide limited access to a range of AWS services for free forever. However, the usage limits reset monthly. Trials: Short-term trial offers start when you activate a part...