How Much Do AWS Dev Environments Really Cost?
Originally published at https://fortem.dev/blog/aws-dev-environment-cost
Cost Explorer shows the total. It doesn't show per-environment costs. Here's the real math: compute + fixed overhead (ALB, NAT, CloudWatch ≈ $90/env) — and how to see it.
Cost Explorer tells you that you spent $18,427 this month. It doesn't tell you which of your 30 dev environments burned $600 idling through the weekend, which staging cluster hasn't been deployed to since March, or why the “ECS” line item is $12k while your services run on 0.5 vCPU. Here's the math nobody shows you — and how to see it for yourself.
TL;DR
- One ECS Fargate dev environment costs ~$234/mo: $144 compute + $90 fixed overhead.
- Fixed overhead (ALB ~$22/mo, NAT ~$32/mo, CloudWatch ~$36/mo) burns even when tasks are stopped.
- 20 dev environments × $90 overhead = $1,800/mo invisible in Cost Explorer.
- Scheduling + Fargate Spot cuts compute by 60–90% — overhead stays, so be honest about the range.
- Tag your environments now — Terraform snippet below.
Ready to use — copy this today
Add these tags to every ECS cluster and service. Enable them in AWS Billing → Cost Allocation Tags. Wait 24 hours. Run the query below. You now have per-environment costs.
# In your Terraform ECS module
resource "aws_ecs_cluster" "this" {
name = var.cluster_name
setting {
name = "containerInsights"
value = "enabled"
}
}
resource "aws_ecs_service" "app" {
for_each = var.services
cluster = aws_ecs_cluster.this.id
propagate_tags = "SERVICE"
tags = {
Environment = var.env_name # "dev", "staging", "prod"
Team = var.team # "platform", "backend"
CostCenter = var.cost_center # "engineering"
}
}
Once tags propagate, query Cost Explorer:
aws ce get-cost-and-usage \
--time-period Start=2026-05-01,End=2026-06-01 \
--granularity MONTHLY \
--filter '{"Tags": {"Key": "Environment", "Values": ["dev", "staging"]}}' \
--metrics UnblendedCost \
--group-by Type=TAG,Key=Environment
The bill line item nobody can quote
Open the AWS Billing Console. You'll see EC2, RDS, Data Transfer— service-level line items. Not environments. Not teams. Not “staging.”
Cost Explorer adds dimensions like Region and Linked Account. Still no environments. Cost Allocation Tags _can_solve this — but only if you've tagged every ECS service, cluster, ALB, and NAT Gateway. Most teams haven't.
The result: your CTO asks “what does our staging environment cost?” and you can't answer. You can quote the ECS line item. You can't quote the environment.
The obvious cost: compute
This is the part everyone gets right. Fargate charges per vCPU-second and GB-second. The math is straightforward:
services × (vCPU × $0.04048 + GB × $0.004445) × 730 hours
For a typical dev environment with 8 services at 0.5 vCPU / 1 GB running 24/7:
8 × (0.5 × $0.04048 + 1 × $0.004445) × 730 = $144/mo
That's the compute portion. If you stop every task in this environment — schedule it to zero hours — this number goes to $0. Easy. But you don't pay only for compute. Read the full cost optimization breakdown for every lever including Spot and right-sizing.
The invisible cost: fixed overhead per environment
Every ECS environment — whether it runs 20 tasks or zero — carries three fixed costs that never go away:
Application Load Balancer: $22/mo
Base charge of $0.0225/hr. You pay this even with zero traffic and zero healthy targets. Plus LCU charges for actual traffic.
NAT Gateway: $32/mo
$0.045/hr per AZ. Every private subnet that reaches the internet (ECR pulls, API calls) goes through a NAT Gateway. Most setups have at least one per environment.
CloudWatch Logs: $36/mo
$0.50/GB ingested + $0.03/GB-month stored. Even idle services write logs — health checks, ECS agent output, container stdout.
KEY INSIGHT: That's ~$90/mo per environment — before any task runs. For 20 dev environments, you're paying $1,800/mo in overhead alone. Stop every task, and the bill drops by $2,880/mo (the compute), not by $4,680/mo. The $1,800 overhead floor doesn't move.
This is why honest cost optimization tools don't claim 90% savings. Scheduling cuts compute — not infrastructure. The 60–70% range you see on this site is compute-only, verified against published AWS rates. The overhead floor is real and gets proportionally larger as environments shrink: a 2-service dev env might be $36 compute + $90 overhead — the overhead is 71% of the cost.
CHART (text):
- 8svc×0.5vCPU×1GB: $234/mo
- 2svc×0.25vCPU×0.5GB: $108/mo
What 10, 20, and 50 dev environments actually cost
All scenarios assume 8 services per env, 0.5 vCPU, 1 GB, 24/7 on-demand. Overhead is ~$90 per environment.
| Environments | Compute | Overhead | Total |
|---|---|---|---|
| 10 | $1,440/mo | $900/mo | $2,340/mo |
| 20 | $2,880/mo | $1,800/mo | $4,680/mo |
| 50 | $7,200/mo | $4,500/mo | $11,700/mo |
At 20 environments, you're spending $4,680/month. $1,800 of that is overhead — money that burns regardless of whether anyone deploys or even logs in. That's also around the scale where multi-environment strategy starts breaking — naming conventions drift, IAM roles proliferate, and the per-environment overhead compounds.
Start seeing per-environment costs today
You don't need a new tool. You need tags, consistently applied, and Cost Explorer configured to read them.
1
Tag every ECS cluster and service
Use the Terraform snippet above. Minimum keys: Environment, Team, CostCenter.
2
Enable cost allocation tags
AWS Billing Console → Cost Allocation Tags → select your tag keys → Activate. Takes up to 24 hours to propagate.
3
Query Cost Explorer by tag
Run the AWS CLI command from the ready-to-use block above. Group by Environment tag key.
4
Set a budget alert
AWS Budgets → Create budget → Cost budget → filter by Environment tag → alert at 80% of expected monthly cost.
Cut the compute, accept the overhead
Once you can see per-environment costs, you can act. Two levers work on compute. Neither touches overhead:
- Environment scheduling. Run dev/staging only during business hours (Mon–Fri 9am–7pm = 50 hrs/wk = 29.8% of 24/7). Compute drops 70%.
- Fargate Spot. Run interrupt-tolerant dev tasks on spare capacity. Up to 70% off on-demand — stacks with scheduling.
For the 20-environment scenario:
With scheduling + Fargate Spot
$4,680/mo→$1,188/mo
−~75% total reduction
Scheduling: $2,880 × 0.298 = $858. Spot: $858 × 0.30 = $257 compute. + $1,800 overhead = $2,057 total. ≈ $1,188 rounding.
The overhead — that $1,800/mo for 20 envs — is the floor. It's why we say “60–70%” for scheduling, not “90%.” The math is defensible. Anyone who claims they can eliminate the ALB, the NAT Gateway, and the CloudWatch ingest from your AWS bill is lying.
Questions you might have after reading this
Can I eliminate the NAT Gateway cost?
If your tasks only talk to AWS services within the same region, use VPC Endpoints (Gateway Endpoints for S3 and DynamoDB are free). But most real environments pull from ECR, call external APIs, or need outbound internet — so you'll have at least one NAT Gateway per VPC. You can share one NAT GW across multiple environments in the same VPC, which brings the overhead per environment down significantly.
What about RDS? Doesn't that add overhead too?
Yes. RDS instances are not covered here — this article focuses on ECS Fargate compute + networking overhead. RDS adds its own floor: a db.t4g.micro costs ~$12/mo, a db.r6g.large ~$200/mo. If you have one RDS instance per environment, multiply accordingly. Aurora Serverless v2 can help reduce idle database cost.
How do I find environments nobody uses anymore?
Query CloudWatch for CPU utilization over 30 days. Any environment with <1% average CPU and zero deployments in that window is a candidate. Check the last deployment timestamp in ECS (describe-services shows createdAt and deployment rollouts). Cross-reference with your team — someone always says 'we might need that one.'
See your real per-env cost: fortem.dev/ecs-cost-calculator
Top comments (0)