ELB cost optimization

ELB cost optimization- CloudSpend

Amazon Elastic Load Balancing (ELB) is a load balancing service that automatically and evenly distributes incoming traffic from client-side applications across multiple virtual server instances, like Amazon EC2 instances, containers, or IP addresses, in different availability zones. It smoothly handles server instance failover and unavailability, thus increasing the application’s fault tolerance.

Types of AWS ELBs

Amazon provides four primary types of load balancers, listed below. Each of these four provide automatic scaling, high availability, robustness, and security.

  • Application Load Balancer: The Application Load Balancer (ALB) is used to make routing decisions based on request content, like HTTP/HTTPS headers. It works at the application layer, i.e., Layer 7 of the Open Systems Interconnection (OSI) model.

  • Network Load Balancer: The Network Load Balancer (NLB) handles TCP, UDP, and TLS traffic and evenly distributes it independently of the content received in the request. It works at the transport layer, i.e., Layer 4 of the OSI model.

  • Gateway Load Balancer: The Gateway Load Balancer (GLB) helps deploy, manage, and scale third-party virtual appliances and distribute traffic across them. It works at the network layer (Layer 3) of the OSI model. It provides high availability by eliminating potential failure zones in the network. These virtual appliances are tested and bought by vendors directly from the AWS Marketplace.

  • Classic Load Balancer: The Classic Load Balancer (CLB) operates at the request and connection levels and distributes traffic across multiple EC2 instances residing in one or more availability zones. The CLB uses features of Layer 7 when dealing with HTTP/HTTPS applications. It can also use features of Layer 4 when dealing with applications purely based on the TCP protocol.

Understanding the pricing of various ELBs

The pricing structure of a CLB is pretty straightforward, as it is based on the amount of traffic processed per region. Meanwhile, the pricing structure of the ALB, NLB, and GLB tends to be more complicated thanks to a special metric called a Load Balancer Capacity Unit (LCU).

This metric is calculated based on certain dimensions, such as the number of new connections made per second, active connections per minute, or how much traffic is processed. The number of LCUs used per hour is determined based on the dimension with a maximum rate of usage. These dimensions are different for each load balancer. Moreover, the cost for these load balancers varies from region to region.

ALB

The ALB calculates the bill for the traffic processed based on the number of LCUs used per hour, or partial hour for which the load balancer was running. The pricing structure of the ALB includes the following dimensions:

Dimension

Description

Value of single LCU

New connections

Number of new connections established/second

25 new connections/second

Active connections

Number of active connections/minute

3,000 active connections/minute

Processed bytes

Number of bytes (in GB/hour) processed by the load balancer for HTTP/HTTPS requests

– If targets are EC2 instances, IP addresses, or containers, 1GB/hour

– If targets are Lambda functions, 0.4GB/hour

Rule evaluations

Product of the number of rules processed by the load balancer and request rate (minus 10 free rules). The first 10 rules are free.

1,000 rule evaluations/second

Charges are incurred for the ALB based on whichever dimension consumes the maximum number of LCUs in an hour.

For the US East (Ohio) region:

● The standard charge for each ALB per hour/partial hour is $0.0225.

● The standard charge for each LCU per hour/partial hour is $0.008.

To understand how ALB pricing works, let’s suppose that an application receives an average of five new connections every second, and each new connection lasts for a minute. A client sends an average of 10 requests each second and processes 1.5GB of data an hour. Also, the load balancer is configured with 20 rules to route client requests. The cost of ALB usage in the US East (Ohio) region will be determined by the following:

● New connections per second

= given new connections/provided new connections by LCU

= 5/25

= 0.2 LCUs

● Active connections per minute

= given active connections per minute/provided active connections by LCU

= (5 * 1 * 60)/3000

= 0.1 LCUs

● Processed bytes in GB per hour

= data processed by LCU/data provided by LCU

= 1.5/1

= 1.5 LCUs

● Rule evaluation per second

= (request rate * (number of rules processed by LCU – 10 free rules))/rule evaluations provided by LCU

= (10 * (20 – 10))/1000

= 0.1 LCUs

In this example, the maximum number of LCUs is consumed by the processed bytes dimension, i.e., 1.5 LCUs.

● Total number of LCUs used = 1.5

● Total LCU usage cost per hour

= number of consumed LCUs * standard LCU charge per hour

= 1.5 LCUs * $0.008

= $0.84

● Total ALB usage cost per month

= (LCU cost per hour + standard ALB charge per hour) * number of hours in a month

= ($0.84 + $0.0225) * 30 days * 24 hours

= $13.608

As a result, the monthly AWS bill for ALB usage for this use case will total $13.608.

NLB

NLB usage is billed based on the Network Load Capacity Units (NLCUs) consumed per hour or partial hour. The pricing structure of the NLB includes the following dimensions: 

 

Dimension

 

Description

Value of single NLCU

TCP

UDP

TLS

New connections or flows

Number of new connections or flows established/second

800

400

50

Active connections or flows

Number of active connections or flows/minute

100,000

50,000

3,000

Processed bytes

Number of bytes (in GB/hour) processed by the load balancer

1 GB

1 GB

1 GB

The pricing cost of the NLB is generated based on whichever dimension consumes the maximum number of NLCUs in an hour.

For the US East (Ohio) region:

● The standard charge for each NLB per hour or partial hour is $0.0225.

● The standard charge for each NLCU per hour or partial hour is $0.006.

Let’s suppose, for example, that an application receives an average of 10 new TCP connections per second, and each connection remains active for three minutes and processes 100 bytes of data. The cost of NLB usage in the US East (Ohio) region will be determined by the following:

● New TCP connections or flows per second

= given new TCP connections/provided new TCP connections by NLCU

= 10/800

= 0.0125 NLCUs

● Active TCP connections per minute

= given active TCP connections per minute/provided active TCP connections by NLCU

= (10 * 3 * 60)/100000

= 0.018 NLCUs

● Data processed by NLCU in GB per hour

= new TCP connections per second * data processed by each TCP connection in GB * number of seconds in an hour

= (10 * 1000 bytes/(1000 * 1000 * 1000)) * 3600)

= 0.036GB per hour

● Processed bytes in GB per hour

= data processed by NLCU/data provided by NLCU

= 0.036/1

= 0.036 NLCUs

In this example, the maximum number of NLCUs is consumed by the processed bytes dimension, i.e., 0.036 NLCUs.

● Total number of NLCUs used = 0.036

● Total NLCU usage cost per hour

= number of consumed NLCUs * standard NLCU charge per hour

= 0.036 NLCUs * $0.006

= $0.000216

● Total NLB usage cost per month

= (NLCU cost per hour + standard NLB charge per hour) * number of hours in a month

= ($0.000216 + $0.0225) * 30 days * 24 hours

= $16.355

As a result, the monthly AWS bill for NLB usage for this use case will total $16.355.

GLB

The GLB pricing structure has a standard hourly rate per region based on the number of Gateway Load Capacity Units (GLCUs), and the dimensions used to calculate GLCUs are:

Dimension

Description

Value of single GLCU

New connections or flows

Number of new connections or flows established/second

600 new connections/second

Active connections or flows

Number of active concurrent connections or flows sampled/minute

60,000 active connections/minute

Processed bytes

Number of bytes (in GB/hour) processed by the load balancer

– For EC2 instances as targets, containers, and IP addresses, 1GB/hour

– For Lambda functions as targets, 1GB/hour

The pricing cost of the GLB is generated based on whichever dimension consumes the maximum number of GLCUs in an hour.

For the US East (Ohio) region:

● The standard charge for each GLB per hour or partial hour is $0.0125.

● The standard charge for each GLCU per hour or partial hour is $0.004.

● The standard charge for data processed per GB for the endpoint is $0.0035.

● The standard charge for each endpoint per hour is $0.01.

Let’s assume, for example, that the GLB is configured to handle single-zone deployment and receives 30 new connections per second, and each connection lasts for 10 minutes and consumes 1KB of data. Let’s also assume that the targets are AWS Lambda functions. The cost of GLB usage in the US East (Ohio) region will be determined by the following:

● New connections or flows per second

= given new connections/provided new connections by GLCU

= 30/600

= 0.05 GLCUs

● Active connections per minute

= given active connections per minute/provided active connections by GLCU

= (30 * 10 * 60)/60000

= 0.3 GLCUs

● Data processed by GLCU in GB per hour

= new connections per second * data processed by each connection in GB * number of seconds in an hour

= 30 * (1KB/(1000 * 1000) * 3600

= 0.108GB per hour

● Processed bytes in GB per hour

= data processed by GLCU/data provided by GLCU

= 0.108/0.4

= 0.27 GLCUs

In this example, the maximum number of GLCUs is consumed by the active connections dimension, i.e., 0.3 GLCUs.

● Total number of GLCUs used = 0.3

● Total GLCU usage cost per hour

= number of consumed GLCUs * standard GLCU charge per hour

= 0.3 * $0.004

= $0.0012

● GLB endpoint cost per hour

= number of endpoints * standard endpoint charge per hour

= 1 * $0.01

= $0.01

● GLB data processing cost for endpoint per hour

= data processed in GB per hour *standard endpoint data processing charge per hour

= 0.27 * $0.0035

= $0.000945

● Total GLB usage cost per month

= (GLCU cost per hour + GLB endpoint cost per hour + GLB endpoint data processing cost per hour + standard GLB charge per hour) * number of hours in a month

= ($0.0012 + $0.01 + $0.000945 + $0.0125) * 30 days * 24 hours

= $8.744

As a result, the monthly AWS bill for GLB usage will total $8.744.

CLB

AWS charges for the CLB either per hour or partial hour as per region at a standard per GB rate for the data transferred by the load balancer. CLB pricing structure doesn’t include the LCU metric.

For the US East (Ohio) region:

● The standard charge for each CLB per hour is $0.025.

● The standard data processing charge per hour is $0.008.

For our example, let’s assume that one CLB handles the traffic routing of multiple AWS EC2 instances and consumes 1GB of data per hour.

● Total CLB usage cost per month

= ((data processed by CLB * standard data processing charge per hour) + standard CLB charge per hour) * number of hours in a month

= ((1 GB * $0.008) + $0.025) * 30 days * 24 hours

= $23.76

As a result, the monthly AWS bill for CLB usage for this use case will total $23.76.

Optimizing ELB costs

Each of these load balancers follows their own pricing model, and the cost of load balancer usage varies as per the infrastructure setup. Between these four load balancers, the CLB is the most affordable, as its cost simply depends on its uptime and the amount of traffic processed.

The other three load balancers are comparatively expensive, because their pricing model is built on the LCUs consumed. The NLB has the highest usage cost out of the load balancers covered in this guide, as it calculates cost based on the fixed number of LCUs consumed and the GB of data processed per hour, just like other load balancers—but it also charges for additional usage.

When selecting the best and most affordable load balancer, it is important to consider the needs of your application by comparing key features provided by each load balancer. Ideally, you should first check the load balancer pricing with the AWS pricing calculator before making a decision.

Using CloudSpend to optimize ELB costs

ManageEngine created its cloud cost management tool, CloudSpend, for customers to efficiently manage cloud costs by implementing optimization techniques such as chargebacks, reserving capacity, and right-sizing resources.

CloudSpend provides automated bill processing to make AWS cost optimization easier. This automated bill processing feature provides deep visibility into AWS costs by extracting necessary cost categories like data transfer type, operation type, usage type, region, and availability zone.

CloudSpend also provides a feature to analyze monthly and yearly expense reports. This makes it easier to understand AWS billing and keep track of cost distribution by region, instance type, data transfer, and more.

ramji.ry@zohocorp.com
Product Marketer