If you run 24/7 background workers, enrichment pipelines, or lightweight scrapers on AWS EC2 T-series instances (t3, t3a, t4g), there is a good chance you are quietly paying 2x–3x more than you think.

Not because of instance size—but because of one default flag: CPUCredits: unlimited.

When tuning our 24/7 data enrichment pipeline on AWS Graviton2 (ap-south-1 Mumbai), we caught a hidden $0.62/day CPU surplus credit leak on a tiny t4g.micro, switched to t4g.small in standard mode, refactored two bottlenecks in Python, and ended up cutting daily compute cost by more than half while increasing throughput by ~67%.

Here is the exact FinOps + code optimization breakdown.

1. The Hidden unlimited CPU Credit Trap on t4g.micro

A t4g.micro (2 vCPU, 1 GB RAM) has a 10% baseline CPU utilization per vCPU. Under light intermittent workloads, you earn CPU credits while idle and spend them during brief bursts.

Under a 24/7 data pipeline, your instance rarely stays below 10% CPU:

  • When CPU credits run dry in unlimited mode, AWS does not throttle your instance. Instead, it silently charges surplus CPU credits (APS3-CPUCredits:t4g).
  • In our t4g.micro unlimited baseline, fixed instance + IPv4 + EBS cost was only ~$0.32/day, but surplus CPU credit charges added $0.62/day, pushing total spend to ~$0.95/day for roughly ~300 records/hour.

The Fix: t4g.small + standard Credit Mode

Switching to t4g.small (2 vCPU, 2 GB RAM, 20% baseline) and explicitly forcing CPU credit mode to standard:

aws ec2 modify-instance-credit-specification \ --region ap-south-1 \ --instance-credit-specification "InstanceId=i-YOUR_INSTANCE_ID,CpuCredits=standard" 

Verify it applied cleanly:

aws ec2 describe-instance-credit-specifications \ --region ap-south-1 \ --instance-ids i-YOUR_INSTANCE_ID 

In standard mode:

  • Surplus CPU burst fees drop strictly to $0.00.
  • Double the RAM (1 GB -> 2 GB + 4 GB swap) eliminates OOM thrashing and swap-heavy CPU stalls.
  • Exact fixed daily breakdown (ap-south-1):
    • EC2 Compute (t4g.small): $0.2688/day
    • Public IPv4: $0.1200/day
    • EBS gp3 SSD: $0.0608/day
    • Data Transfer: ~$0.0040/day
    • Surplus Burst Fees: $0.00/day
    • Total Fixed Daily Cost: $0.45/day (less than half of $0.95/day!)

(Rule of thumb: If your workload truly needs sustained 100% CPU all day without throttling, benchmark c6g.medium (~$0.70/day in ap-south-1) instead of leaving a T-series instance in unlimited.)

2. Why Hardware Sizing Alone Isn't Enough: 2 Zero-Cost Code Fixes

Downsizing compute bills fails if your code is burning CPU on things it shouldn't do in the first place. On the exact same t4g.small standard node, two surgical code changes unlocked huge throughput gains:

Fix A: Stop Spawning Headless Chrome When Plain HTTP Works

Our worker container (gosom/google-maps-scraper) originally had an -email enrichment flag enabled that launched full headless Chrome sessions to extract contact emails from target websites.

  • Headless Chromium on a 2 GB ARM64 node eats massive RAM, triggers context switches, and wastes CPU credits rendering JS/CSS for static contact pages.
  • Change: Removed the redundant headless-browser flag from the scraper container and moved email extraction to a lightweight Python enrichment step.

Fix B: Parallel HTTP Enrichment with ThreadPoolExecutor

Instead of scraping contact pages serially or via headless Chromium, our Python enricher (lead_processor.py) fetches raw HTML directly with a bounded 10-thread ThreadPoolExecutor:

  • Parses mailto: links and strict regex patterns from the landing page HTML.
  • Falls back cleanly to /contact and /contact-us paths only when the homepage lacks a valid match.
  • Preserves strict email validation rules (is_clean_business_email) so throughput gains don't pollute data quality.

3. Verified 4.75-Hour Steady-State Benchmark

After deploying both the t4g.small standard change and the parallel Python enricher, we ran a continuous 4.75-hour benchmark on live production traffic:

Metric Old (t4g.micro unlimited + Browser Extraction) New (t4g.small standard + 10-Thread HTTP) Improvement
Daily Infrastructure Cost ~$0.95/day $0.45/day -52.6% cheaper
Hidden Burst Surcharges $0.62/day $0.00/day Eliminated
Sustained Throughput ~300 leads/hr 501.3 leads/hr (+603, +471, +434, +569 consecutive hrs) +67% faster
24h Daily Capacity ~7,200/day ~12,000/day +4,800/day
Cost per 1,000 Leads $0.132 $0.037 3.5x cheaper
Quality Parity (Email / Social Rate) 58.7% / 52.5% 55.5% / 52.9% (2,371-lead sample) Comparable quality

FinOps Checklist for Any T-Series EC2 Workload

  1. Audit CpuCredits on every t3 / t3a / t4g instance today. Many launch templates default to unlimited. Check AWS Cost Explorer for CPUCredits line items—they add up fast on continuous workers.
  2. Enforce standard mode on predictable batch workers, or upgrade one tier (micro -> small) for double the baseline (10% -> 20%) and double the RAM.
  3. Kill headless browsers inside extraction loops. Replacing Chromium DOM scraping with bounded ThreadPoolExecutor HTTP checks frequently yields bigger speedups than upgrading from 2 vCPU to 8 vCPU.