StratusGrid Knowledge Base | Your Source for AWS Cloud Expertise

How to Remediate Idle Load Balancers | Stratusphere™

Written by Stratusphere's AWStronaut | Feb 29, 2024 11:31:24 PM

Amazon Elastic Load Balancer (ELB) is a managed load balancing service that helps you build scalable and highly-available business applications. There are several different types of load balancers available in the ELB service, including the OSI Layer 4 Network Load Balancer (NLB), the Layer 7 Application Load Balancer (ALB), and the Gateway Load Balancer

When you provision a load balancer, you also configure one or more service “backends” that requests will be forwarded to, and fulfilled by. The load balancer doesn’t fulfill requests itself, it simply balances the inbound requests across an array of backends.

Since backend services can fail, the ELB service allows you to specify “health checks” that periodically run against the backends (aka. targets), to ensure they’re responding in a timely manner and with an appropriate HTTP status code.

Identify Idle Load Balancers

With AWS, and any other cloud vendor, it’s easy to deploy load balancers. However, any provisioned load balancers will increase your AWS monthly spend, even if they’re not actively being used. You might deploy a load balancer, with the intention of using it, but never configure any backend services to route inbound requests to.

You might also stand up a new application, with a configured load balancer, but end users aren’t accessing it due to lack of awareness. In scenarios like this, the load balancer is costing you money every month, but isn’t providing any business value.

Stratusphere™ is a Software-as-a-Service (SaaS) tool from StratusGrid that helps you identify load balancers that aren’t being utilized. Stratusphere™ works at the organizational level, so you can visualize this data across every AWS region, and all of your AWS accounts. There are filters available, so you can limit which portfolio companies (for Private Equity firms), AWS regions, and AWS services you’re targeting.

Under the Findings section of Stratusphere™, you can specify the Service filter for Elastic Load Balancing, and identify unused load balancers with the “Idle Load Balancers” finding. Check out the screenshot below for an example. An idle load balancer is identified as one that has one of the following conditions:

  • Load balancer does not have any backends (targets) configured
  • Load balancer does not have any healthy backends, based on configured health checks
  • Load balancer has fewer than 100 inbound requests over a 7-day lookback period

Stratusphere™ acquires these findings from the AWS Trusted Advisor service, and aggregates them to simplify your cost savings journey at scale.

Now that you have learned how to identify idle load balancers in your AWS accounts, let’s discuss how you can remediate this cost optimization finding.

Risks & Other Considerations

Before you remediate an AWS load balancer, it’s important to note some of the risks associated with this activity.

  • Risk: Deleting a load balancer may prevent users from accessing an application
    • Resolution: Ensure that any applications behind a load balancer have been completely retired, or migrated to a new solution, before deleting the load balancer.
  • Risk: Health checks are failing due to misconfiguration.
    • Resolution: If the health checks are failing on a load balancer, it is possible that it could result from a misconfiguration. Contact the application owner to determine the correct configuration for a load balancer health check, and validate that the load balancer is configured correctly.

Remediation

There are a couple of different ways you can go about remediating the idle load balancer finding.

  • Configure backends / targets for the load balancer, if they are missing
  • Ensure the load balancer’s health checks are configured correctly
  • Route application or end user traffic to the load balancer, to utilize it
  • Delete the load balancer from your AWS account

The easiest method of remediating this situation is to simply delete the load balancer from your AWS account, so we’ll focus on this approach. Delete the load balancer will stop billing for that resource, and reduce the accruing costs on your next invoice. Elastic Load Balancer is part of the Amazon EC2 service umbrella. To delete an ELB from your AWS account, follow the steps below.

  1. Login to the AWS Management Console
  2. Select the AWS Region where your load balancer resides
  3. Navigate to the Amazon EC2 service
  4. Select Load Balancers, under Load Balancing, in the left-hand nav
  5. Select your Idle Load Balancer from the list
  6. Select the Actions ➡️ Delete Load Balancer option (see screenshot below)

After following these manual steps, the load balancer may take a moment to delete. Once the resource is gone, your next AWS invoice should reflect the reduced hours of load balancer spend. You can repeat this process for each ELB identified in the Stratusphere™ cost optimization findings.

Automated Remediation

If you need to remediate a large number of AWS load balancers, across many different AWS regions and accounts, then automating the process will save you a significant amount of time. You can use any of the AWS Software Development Kits (SDK) to call the necessary REST APIs that delete the load balancers. Common tools for this include the AWS CLI tool and the AWS Tools for PowerShell modules.

You can install these tools on your local development workstation or access them through the built-in AWS CloudShell environment, from the AWS Management Console.

AWS CLI

The following AWS CLI commands will help you discover and delete the specified load balancer from your AWS account.

# Discovery the load balancers provisioned in a specific region
aws elbv2 describe-load-balancers --region us-west-1

# Delete the load balancer with the specified Amazon Resource Name (ARN)
aws elbv2 delete-load-balancer  --region us-west-1 --load-balancer-arn arn:aws:elasticloadbalancing:us-west-1:973081273628:loadbalancer/app/sg01/b546bfba02159130

AWS PowerShell Commands

The AWS Tools for PowerShell can help you automate the discovery and deletion of load balancers as well. Because there’s a separate PowerShell module for each AWS service, you’ll need to install the module that targets ELB.

Install-Module -Name AWS.Tools.ElasticLoadBalancingV2 -Scope CurrentUser -Force

# Retrieve a list of load balancers, in the specified AWS region
Get-ELB2LoadBalancer -Region us-west-1

# Delete the load balancer with the specified ARN
Remove-ELB2LoadBalancer -LoadBalancerArn '<paste_arn_here>' -Region us-west-1

Optimize Your AWS Spend with Stratusphere™ FinOps by StratusGrid

Idle load balancers can increase your AWS costs, without providing any business value, if they are unconfigured, misconfigured, the backend service is unhealthy, or end users simply aren’t accessing them.

You can easily remediate these cost findings by removing the load balancer from your AWS account. You can also fix the backend application, configure load balancers that are unconfigured, or drive user traffic to the service, to remediate this finding.

If you need help performing more advanced automation for cost optimization findings, feel free to reach out to the StratusGrid team. We would love the opportunity to partner with you and assist with optimizing your entire cloud environment!

Here are some additional resources about Amazon Elastic Load Balancing (ELB) service.

See Stratusphere™ FinOps in Action Here:

 

BONUS: Download Your FinOps Guide to Effective Cloud Cost Optimization Here ⤵️