AWS Cost Efficiency

AWS Elastic Load Balancing (ELB): Pricing Breakdown and Cost Optimization

Did you know?

ELB processed over 35 quintillion requests in 2021. That's a 35 followed by 18 zeros (35,000,000,000,000,000,000)! This massive number showcases the immense scale and traffic handling capabilities of ELB within the AWS cloud.

To ensure smooth and efficient operation of your applications, it is important to understand how AWS Elastic Load Balancers (ELBs) work.

By learning about features such as listener rules, target groups, and autoscaling, you can maximize the benefits of ELBs to improve your application's performance.

With this knowledge, you can make informed decisions when setting up your infrastructure, enabling your applications to scale easily and provide optimal service to your users while also reducing and optimising ELB costs.

Understanding AWS Elastic Load Balancer Pricing

Classic Load Balancer Pricing

Pricing depends on the number of Classic Load Balancer-hours used and the amount of data processed by the load balancer.

Application Load Balancer Pricing

Pricing is influenced by the number of Application Load Balancer hours utilised, the number of Load Balancer Capacity Units (LCUs) consumed, and, if applicable, the usage of the Trust Store for Mutual TLS.

AWS Application Load Balancers’ feature HTTP header based routing enabled us to meet the requirements during peak seasons to ensure the best customer experience. With Application Load Balancers, we can scale our services 10x, meeting peak demand for apps running on EC2. - Neeraj S Chauhan - Chief Information Officer, PayU[3]

Network Load Balancer Pricing

Pricing is determined by the number of Network Load Balancer-hours utilised and the consumption of Network Load Capacity Units (NLCUs).

The built-in elasticity of the Application Load Balancers and Network Load Balancers are integral in ensuring that NuData Security’s flagship product, NuDetect, can authenticate users to help prevent an increasing amount of fraudulent activity in our customers' environments in real time. - Ian Cheng - Director, DevOps Engineering, NuData[3]

Gateway Load Balancer Pricing

Pricing is based on the number of Gateway Load Balancer-hours used per Availability Zone (AZ) and the consumption of Gateway Load Capacity Units (GLCUs).

Below is an overview of the pricing structure for Elastic Load Balancer in the Asia Pacific (Mumbai) region.[1]

Load Balancer Type
Hourly Rate Per Unit Data
Classic Load Balancer  $0.025  $0.008 per GB of data processed 
Application Load Balancer  $0.0239  $0.008 per LCU-hour (or partial hour) 
Network Load Balancer  $0.0225  $0.006 per NLCU-hour (or partial hour) 
Gateway Load Balancer  $0.0125 per AZ  $0.004 per GLCU-hour (or partial hour) 

Factors Associated with ELB Costs

To effectively manage your ELB costs, selecting the appropriate ELB for your infrastructure setup is crucial. Therefore, it is vital to thoroughly comprehend the key comparison factors among the several types of load balancers.[2]

Features
Classic Load Balancer Application Load Balancer Network Load Balancer
Gateway Load Balancer
Protocol Support  TCP, SSL/TLS, HTTP, HTTPS  HTTP, HTTPS  TCP, TLS  N/A 
Layer Supported Network  Layer 7  Layer 7  Layer 4  Layer 3 Gateway + Layer 4 Load Balancing 
LCU  N/A  $0.008 per LCU-hour (or partial hour)  $0.006 per NLCU-hour (or partial hour)  $0.004 per GLCU-hour (or partial hour) 
Performance  Moderate  Slowest  Fastest  N/A 
Path Routing  Not Supported  Yes  Not Supported  N/A 
Sticky Sessions  Yes, redirected to same machine  Yes, redirected to same target  Not Supported  N/A 
Static/Elastic IP  Not Supported  Not Supported  Yes  N/A 
Load Balancing for Multiple Ports  Not Supported  Yes  Yes  N/A 
Idle Connection Configuration  Yes  Yes  No  N/A 
Preserve Source IP  Not Supported  Not Supported  Yes  N/A 
Support Targets outside AWS  Not Supported  Yes  Yes  N/A 
Cost Differences (per use case configuration)  $24.09  $22.27  $20.81  $0.0125 per AZ 

Understanding the pricing breakdown of various ELBs

Understanding the pricing breakdown of various ELBs involves analysing key dimensions such as new connections, active connections, processed bytes, and rule evaluations. These metrics determine the cost of load balancing services and play a crucial role in optimising expenses while ensuring efficient traffic distribution.

Pricing Dimension
Classic Load Balancer Application Load Balancer Network Load Balancer
Gateway Load Balancer
New Connections  N/A  25 per second  TCP: 800 per second,

UDP: 400 per second,

TLS: 50 per second
 
600 per second 
Active Connections  N/A  3,000 per minute, (1,500 with Mutual TLS)   TCP: 100,000 per minute,

UDP: 50,000 per minute,

TLS: 3,000 per minute
 
600 per second 
Processed Bytes  $0.008 per GB  1 GB per hour  1 GB per hour for TCP, UDP, TLS  1 GB per hour 
Rule evaluation  N/A  1,000 per second  N/A  N/A 

Image for understanding pricing of AWS ELB

Different AWS Load Balancers incur varying monthly charges based on usage scenarios and components.

Load Balancer Type
Scenario Components Charge
Classic Load Balancer  Medium-sized website with 10 EC2 instances in US East (N. Virginia) using one load balancer for traffic balancing 
  • Data Transfer: 100 GB
  • Load Balancer Hours: $18
 
  • Cost of data transfer = 100 GB * $0.008/GB = $0.80
  • Total cost = Load Balancer Hours cost + Data Transfer cost = $18 + $0.80 = $18.80
 
Application Load Balancer  Average of one new connection per second, each lasting two minutes, five requests per second, 300 KB per second data transfer, and 60 configured routing rules 
  • New Connections: 0.04 LCUs
  • Active Connections: 0.04 LCUs
  • Processed Bytes: 1.08 LCUs
  • Rule Evaluations: 0.25 LCUs
 
  • New Connections:0.04 LCUs * $15.89 per LCU ≈ $0.64
  • Active Connections:0.04 LCUs * $15.89 per LCU ≈ $0.64
  • Processed Bytes:1.08 LCUs * $15.89 per LCU ≈ $17.15
  • Rule Evaluations: 0.25 LCUs * $15.89 per LCU ≈ $3.97
  • Total Cost = ≈ $0.64 + $0.64 + $17.15 + $3.97 ≈ $22.40
 
Network Load Balancer  Application receives one new TCP connection per second, lasting two minutes, consuming 300 KB in processed bytes 
  • Active Connections (TCP): 0.0012 NLCUs
  • Bytes Processed (TCP): 1.08 LCUs
 
  • Cost for Active Connections (TCP):0.0012 NLCUs * Cost per LCU = 0.0012 NLCUs * $15.89 per LCU= ≈ $0.019068
  • Cost for Bytes Processed (TCP):1.08 LCUs * Cost per LCU = 1.08 LCUs * $15.89 per LCU= ≈ $17.1592
  • Processed Bytes:1.08 LCUs * $15.89 per LCU ≈ $17.15
  • Total Cost = $0.019068 + $17.1592 ≈ $17.178268
 
Gateway Load Balancer  Single-zone Gateway Load Balancer and a Gateway Load Balancer Endpoint handling incoming connections for the application  
  • New Connections: 0.00167 GLCUs
  • Active Connections: 0.002 GLCUs
  • Bytes Processed: 1.08 GLCUs
  • Hourly Charge: $0.00432
 
  • Total GLCUs per Hour = 0.00167 GLCUs + 0.002 GLCUs + 1.08 GLCUs = 1.08367 GLCUs
  • Total Charge per Hour = $0.00432 * 1.08367 GLCUs ≈ $0.00467
 
Endpoint    
  • Hourly Charge: $0.0138
 
  • Total Usage Cost per Hour = Total Charge / Total Hours of Usage = $9.94 / 719.28 hours ≈ $0.0138
 

What are the Strategies to Optimize ELB Costs?

1. Migrate from CLB to ALB

Transitioning from CLB to ALB minimises ELB costs through granular billing, resource efficiency, enhanced performance, flexible routing, and built-in security, leading to optimised resource utilisation and lower expenses.

Here's an example using AWS CLI to create an ALB and migrate from CLB:

# Create a new ALB
aws elbv2 create-load-balancer --name my-alb --subnets subnet-12345678 subnet-23456789 --security-groups sg-12345678

# Create a target group for the ALB
aws elbv2 create-target-group --name my-targets --protocol HTTP --port 80 --vpc-id vpc-12345678

# Register targets with the target group
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-targets/12345678abcdef --targets Id=i-12345678 Id=i-23456789

# Create a listener for the ALB
aws elbv2 create-listener --load-balancer-arn arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/my-alb/12345678abcdef --protocol HTTP --port 80 --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-targets/12345678abcdef

2. Use Amazon S3 and CloudFront for Static File Delivery

Leveraging Amazon S3 and CloudFront for static file delivery reduces ELB costs by offloading static content serving to CloudFront's edge locations, minimising requests to the ELB, lowering data transfer costs, and enhancing performance for dynamic content.

Here's an example using AWS SDK for Python (Boto3) to configure S3 and CloudFront:

import boto3

# Create an S3 bucket
s3 = boto3.client('s3')
s3.create_bucket(Bucket='my-static-files')

# Upload static files to the S3 bucket
s3.upload_file('path/to/local/file', 'my-static-files', 'file')

# Create a CloudFront distribution
cf = boto3.client('cloudfront')
cf.create_distribution(
    DistributionConfig={
        'CallerReference': 'my-distribution',
        'Origins': {'Quantity': 1, 'Items': [{'Id': 'myS3Origin', 'DomainName': 'my-static-files.s3.amazonaws.com'}]},
        'DefaultCacheBehavior': {'TargetOriginId': 'myS3Origin', 'ViewerProtocolPolicy': 'redirect-to-https', 'AllowedMethods': {'Quantity': 2, 'Items': ['HEAD', 'GET']}},
        'Enabled': True
    }
)

3. SSL/TLS Offloading

SSL/TLS offloading reduces ELB costs by transferring the decryption process from the load balancer to backend servers, enhancing efficiency, potentially reducing the need for additional ELB instances, and maintaining secure communication between clients and servers.

Here's an example using AWS CLI to configure SSL/TLS offloading on an ALB:

# Create a new ALB with SSL/TLS offloading
aws elbv2 create-load-balancer --name my-alb --subnets subnet-12345678 subnet-23456789 --security-groups sg-12345678

# Create a target group for the ALB
aws elbv2 create-target-group --name my-targets --protocol HTTP --port 80 --vpc-id vpc-12345678

# Register targets with the target group
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-targets/12345678abcdef --targets Id=i-12345678 Id=i-23456789

# Create a listener for the ALB with SSL/TLS offloading
aws elbv2 create-listener --load-balancer-arn arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/my-alb/12345678abcdef --protocol HTTPS --port 443 --certificates CertificateArn=arn:aws:acm:region:account-id:certificate/12345678-1234-1234-1234-123456789012 --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-targets/12345678abcdef

4. Use Cost Optimization tools

AWS offers tools like Cost Explorer, Trusted Advisor, and Budgets to optimise ELB costs. Cost Explorer provides spending insights, Trusted Advisor offers optimisation recommendations, and Budgets help set cost thresholds for alerts.

Conclusion

In summary, maximising cost efficiency with AWS Elastic Load Balancing (ELB) optimization is crucial. By rightsizing resources, using auto-scaling, and monitoring costs with tools like AWS Cost Explorer, businesses can manage ELB expenses effectively.

Understanding pricing dimensions and making informed decisions based on usage patterns helps minimize unnecessary costs while maintaining high performance. With a proactive approach to optimization, businesses can save money while ensuring reliable service for their applications.

References

1. Application and Network Traffic Distribution - Elastic Load Balancing Pricing - AWS

2. Elastic Load Balancing

3. Elastic Load Balancing Customers

FAQs

1. How to save load balancer cost?

To save on load balancer costs, implement Auto Scaling to dynamically adjust the number of instances based on traffic, avoiding over-provisioning. Right-size your instances by choosing the appropriate type and size based on your load requirements. Additionally, consider using spot instances where applicable for significant cost savings.

2. What are the benefits of ELB in AWS?

Elastic Load Balancing (ELB) in AWS offers high availability by distributing traffic across multiple targets, ensuring reliability. It provides scalability by automatically adjusting to handle increased traffic loads. ELB also enhances security through integration with AWS security services like IAM and SSL/TLS termination.

3. How can I improve my load balancing?

Improving load balancing can be achieved by implementing health checks to route traffic to healthy instances, using multiple availability zones for redundancy, and optimizing routing algorithms based on your application's needs. Regularly monitoring performance metrics and adjusting configurations as necessary also helps maintain optimal load balancing.

4. Which load balancer is mostly used?

The most commonly used load balancer in AWS is the Application Load Balancer (ALB), which is ideal for HTTP/HTTPS traffic and provides advanced routing capabilities based on content, making it suitable for modern web applications.

5. How to choose a load balancer?

When choosing a load balancer, consider the type of traffic (HTTP/HTTPS, TCP/UDP), required features (e.g., SSL termination, WebSockets), and your application's architecture. Evaluate the performance, scalability, and cost implications of each type of load balancer (ALB, NLB, CLB) to determine the best fit for your use case.

Subscribed !
Your information has been submitted
Oops! Something went wrong while submitting the form.

Similar Blog Posts

Maintain Control and Curb Wasted Spend!
Strategical use of SCPs saves more cloud cost than one can imagine. Astuto does that for you!
Let’s Talk
Let’s Talk