Solo founders and small engineering teams rarely get hit with unexpected five-figure AWS bills because of steady user growth. Almost every viral AWS horror story traces back to one of four silent misconfigurations that slip right past default tutorials.

Here are the four traps, the exact Terraform/IAM guardrails that stop them, and the forensic step most developers accidentally skip when a spike hits.

Trap 1: Routing S3 & DynamoDB Traffic Through a NAT Gateway

When EC2 instances or Lambda functions inside a private subnet talk to Amazon S3 or DynamoDB, AWS routes that traffic through your NAT Gateway by default.

In typical US regions, NAT Gateway charges ~$0.045 per GB processed (on top of hourly fees). Pushing 50 TB of backups, logs, or analytics data to S3 through a NAT Gateway costs ~$2,250/month—even though S3 is inside AWS's own network.

The $0 Fix: VPC Gateway Endpoint

AWS offers free VPC Gateway Endpoints for exactly two services: S3 and DynamoDB.

resource "aws_vpc_endpoint" "s3_gateway" { vpc_id = aws_vpc.main.id service_name = "com.amazonaws.${var.aws_region}.s3" vpc_endpoint_type = "Gateway" route_table_ids = aws_route_table.private[*].id } 

That 6-line Terraform block routes S3 traffic privately over AWS's backbone for $0.00/GB.

Trap 2: Unthrottled Lambda-to-S3 Recursion Loops

Classic serverless outage:

  1. An S3 ObjectCreated event triggers a Lambda function (e.g., resizing an uploaded image or processing a CSV).
  2. The Lambda writes the processed output back into the same S3 bucket without strict prefix filtering.
  3. S3 fires ObjectCreated again -> infinite recursion -> millions of invocations in minutes.

The Fix: Separate Buckets + Reserved Concurrency Cap

Never let a Lambda write back to its own trigger bucket without non-overlapping prefix rules, and always set a hard concurrency ceiling:

resource "aws_lambda_function" "processor" { function_name = "asset-processor" reserved_concurrent_executions = 25 # ... } 

And if a loop is already running in production, you can block all new invocations immediately from the CLI:

aws lambda put-function-concurrency --function-name asset-processor --reserved-concurrent-executions 0 

Trap 3: Missing IAM Region & GPU Instance Locks (Cryptojacking Blast Radius)

When a long-lived IAM Access Key leaks (committed to a repo, exposed in a CI log, or stolen via SSRF on EC2 IMDSv1), attackers almost never launch servers in your primary region. They spin up p4d.24xlarge or g5 GPU instances across 15 unused regions like ap-southeast-2 or eu-north-1.

The Fix: Explicit Deny Permissions Boundary

Attach a permissions boundary (or Organization SCP) that restricts deployments to your approved regions (while preserving global services via NotAction) and blocks high-cost GPU/metal instance families:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyOutsideApprovedRegions", "Effect": "Deny", "NotAction": ["iam:*", "sts:*", "route53:*", "cloudfront:*", "support:*", "budgets:*", "ce:*"], "Resource": "*", "Condition": { "StringNotEquals": { "aws:RequestedRegion": ["us-east-1", "eu-west-1"] } } }, { "Sid": "DenyGPUAndMetalInstances", "Effect": "Deny", "Action": "ec2:RunInstances", "Resource": "arn:aws:ec2:*:*:instance/*", "Condition": { "StringLike": { "ec2:InstanceType": ["p*", "g*", "trn*", "inf*", "*.metal", "*.24xlarge"] } } } ] } 

Trap 4: Deleting Compromised IAM Users Before Exporting CloudTrail Evidence

When founders spot unauthorized charges, their first instinct is to panic-delete the compromised IAM user. That can complicate incident forensics right when you need a clear timeline for an AWS Support billing credit appeal.

Better emergency sequence (First 15 Minutes):

  1. Deactivate the key first (aws iam update-access-key --status Inactive) and attach an explicit Deny * policy so the attacker is locked out immediately while identity metadata stays intact.
  2. Export CloudTrail events (aws cloudtrail lookup-events --max-results 50 > incident_trail.json) to preserve timestamped UTC evidence.
  3. Sweep all enabled regions for rogue EC2 instances, NAT Gateways, and Bedrock/SageMaker endpoints.
  4. Apply permanent guardrails (Root MFA, AWS Budgets + Cost Anomaly Detection, IAM region lock) before opening your AWS Support Billing case.

Open-Source 6-Gate Rubric & Automated AI Auditor Skill

I published the open-source 6-Gate AWS Bill Shock Audit Rubric on GitHub so you can run through these checks before every deployment:

If you use Claude Code, Cursor, Antigravity, or ChatGPT and want an automated pre-deploy auditor + 15-minute containment runbook + AWS Support billing appeal kit: