Ensure unused Elastic Load Balancers are deleted

Error: Unused Elastic Load Balancers are present

Bridgecrew Policy ID: BC_AWS_GENERAL_21
Severity: LOW

Unused Elastic Load Balancers are present

Description

Amazon Elastic Load Balancers that are actively configured in your AWS account are adding charges to your monthly bill. If an ELB has no associated back-end instances, it is recommended to register instances or deleting it.

Fix - Runtime

AWS Console

  1. Go to Amazon EC2 console.
  2. On the navigation pane, under LOAD BALANCING, choose Load Balancers.
  3. Select the load balancer, and then choose Actions, Delete.
  4. When prompted for confirmation, choose Yes, Delete.
  5. To delete a load balancer using the AWS CLI

Fix - Buildtime

Terraform

Resource: aws_elb, aws_lb

- resource "aws_elb" "bar" {
-  name               = "foobar-terraform-elb"
-  availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]

-  access_logs {
  -  bucket        = "foo"
  -  bucket_prefix = "bar"
  -  interval      = 60
  }

-  listener {
  -  instance_port     = 8000
  -  instance_protocol = "http"
  -  lb_port           = 80
  -  lb_protocol       = "http"
  }