AWSElastic Load BalancingNetworking

aws_lb_target_group cost estimation

A target group is free. It routes traffic to registered targets for an ALB or NLB, and the cost sits on the load balancer and the targets themselves.

An aws_lb_target_group defines a set of targets (instances, IPs, or Lambda functions) and the health checks that decide which are eligible to receive traffic from an Application or Network Load Balancer. The target group has no charge. Health checks are free, and registering targets is free.

The cost lives in two places the target group points at. First, the load balancer that forwards to the group: an ALB or NLB carries a fixed hourly charge plus a capacity-unit charge (LCU or NLCU) that scales with connections, new flows, and processed bytes. Second, the targets themselves: the EC2 instances or Lambda functions doing the work. A target group is the wiring between them, not a billed component.

There is a subtle cost interaction worth knowing: cross-zone load balancing. On an NLB, traffic sent to targets in another AZ incurs cross-AZ data transfer, and enabling cross-zone load balancing on an NLB turns that on. On an ALB, cross-zone is always on and the transfer is included. So the target group's cross-zone setting can quietly add data transfer cost on NLBs.

c3x prices the load balancer and the registered targets, and treats the target group as the free routing construct it is.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "aws_lb_target_group" "app" {
  name        = "app-tg"
  port        = 8080
  protocol    = "HTTP"
  vpc_id      = aws_vpc.main.id
  target_type = "instance"

  health_check {
    path                = "/healthz"
    healthy_threshold   = 2
    unhealthy_threshold = 2
    interval            = 15
  }
}

Pricing dimensions

What you actually pay for when you provision aws_lb_target_group.

DimensionUnitWhat's being charged
Target groupfreeThe group, its targets, and health checks have no charge.
$0
Load balancer (ALB/NLB)per hour + per LCU/NLCUThe balancer that forwards to the group carries the real cost.
ALB: ~$0.0225/hour + LCU
Cross-zone transfer (NLB)per GBTraffic to targets in another AZ when cross-zone load balancing is enabled on an NLB.
$0.01/GB each way

Optimization tips

Common ways to reduce aws_lb_target_group cost without changing the workload.

Watch cross-zone on NLBs

Enabling cross-zone load balancing on an NLB adds cross-AZ data transfer. Leave it off unless you need the even distribution, or expect the transfer charge.

Consolidate target groups behind one ALB

One hourly balancer charge instead of many

One ALB with host and path routing rules to several target groups is cheaper than running a separate load balancer per service.

FAQ

Does a target group cost money?

No. Target groups, registered targets, and health checks are free. You pay for the load balancer that forwards to the group and for the targets that handle the traffic.

Can a target group cause data transfer charges?

Indirectly. On a Network Load Balancer, enabling cross-zone load balancing sends traffic to targets in other AZs, which incurs cross-AZ transfer. On an ALB, cross-zone is always on and included.

How do I estimate the real cost behind a target group?

Price the load balancer (hourly plus capacity units) and the targets (instances or Lambda). c3x does this and treats the target group as free.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_lb_target_group.