standard
turbot/aws_thrifty

Overview

Amazon EC2 classic load balancers with no instances attached still cost money and should be deleted. This query trigger identifies EC2 classic load balancers with no instances attached and either sends notifications or attempts predefined corrective actions.

Getting Started

By default, this trigger is disabled, but can be configured by setting the variables:

  • ec2_classic_load_balancers_if_unused_trigger_enabled should be set to true (default is false).
  • ec2_classic_load_balancers_if_unused_trigger_schedule should be set according to your desired running schedule.
  • ec2_classic_load_balancers_if_unused_default_action should be set to "notify" or any other desired action (e.g., "notify" for notifications or "delete_load_balancer" to delete the classic load balancers).

Then starting the server:

flowpipe server

or if you've set the variables in a .fpvars file:

flowpipe server --var-file=/path/to/your.fpvars

Query

select
concat(name, ' [', region, '/', account_id, ']') as title,
name,
region,
sp_connection_name as conn
from
aws_ec2_classic_load_balancer
where
jsonb_array_length(instances) <= 0

Schedule

15m

Tags

category = Cost
class = unused
plugin = aws
service = AWS/EC2