Table: aws_elbv2_target_groups

This table shows data for Amazon Elastic Load Balancer (ELB) v2 Target Groups.

https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetGroup.html (opens in a new tab)

The primary key for this table is arn.

Relations

The following tables depend on aws_elbv2_target_groups:

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
account_idutf8
regionutf8
tagsjson
arn (PK)utf8
health_check_enabledbool
health_check_interval_secondsint64
health_check_pathutf8
health_check_portutf8
health_check_protocolutf8
health_check_timeout_secondsint64
healthy_threshold_countint64
ip_address_typeutf8
load_balancer_arnslist<item: utf8, nullable>
matcherjson
portint64
protocolutf8
protocol_versionutf8
target_group_arnutf8
target_group_nameutf8
target_typeutf8
unhealthy_threshold_countint64
vpc_idutf8

Example Queries

These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.

Unused ELB load balancer

WITH
  listener AS (SELECT DISTINCT load_balancer_arn FROM aws_elbv2_listeners),
  target_group
    AS (
      SELECT
        DISTINCT unnest(load_balancer_arns) AS load_balancer_arn
      FROM
        aws_elbv2_target_groups
    )
SELECT
  'Unused ELB load balancer' AS title,
  lb.account_id,
  lb.arn AS resource_id,
  'fail' AS status
FROM
  aws_elbv2_load_balancers AS lb
  LEFT JOIN listener ON listener.load_balancer_arn = lb.arn
  LEFT JOIN target_group ON target_group.load_balancer_arn = lb.arn
WHERE
  listener.load_balancer_arn IS NULL OR target_group.load_balancer_arn IS NULL;

Unused ELB target group

SELECT
  'Unused ELB target group' AS title,
  account_id,
  arn AS resource_id,
  'fail' AS status
FROM
  aws_elbv2_target_groups
WHERE
  COALESCE(array_length(load_balancer_arns, 1), 0) = 0;