惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
GbyAI
GbyAI
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
小众软件
小众软件
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
F
Fortinet All Blogs
博客园 - 【当耐特】
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy
O
OpenAI News
V
V2EX
博客园 - 三生石上(FineUI控件)
AI
AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
P
Privacy International News Feed
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
H
Help Net Security
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tenable Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cisco Talos Blog
Cisco Talos Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Hacker News: Ask HN
Hacker News: Ask HN
S
Security @ Cisco Blogs
S
Securelist
T
The Blog of Author Tim Ferriss
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
雷峰网
雷峰网
V2EX - 技术
V2EX - 技术

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Visualize Infracost on Your Architecture Diagram
Raghvendra P · 2026-05-12 · via DEV Community

Infracost estimates your monthly cloud bill from Terraform code before you deploy. But its output — a long table of resource costs in the terminal — makes it hard to see which part of your architecture is driving spend. Is it the database? The NAT gateway? The EC2 fleet?

InfraSketch's cost overlay answers this visually. Run infracost breakdown --format json, paste the output, and every resource node in your architecture diagram gets a colour-coded cost pill showing its monthly cost. Green for cheap, red for expensive. See your cloud bill spatially, in context.

TL;DR: Generate your diagram → click 💰 Cost → paste infracost breakdown --path . --format json output → colour-coded cost badges appear on every resource. Free, no login, stays in your browser.

The problem with cost tables

Here's a typical Infracost breakdown summary:

Name                                         Monthly Qty  Unit   Monthly Cost
aws_instance.web_server                               730  hours        $73.00
aws_db_instance.postgres                              730  hours       $185.10
aws_nat_gateway.main                                    1  months        $32.40
aws_elasticache_cluster.sessions                      730  hours        $25.55
...
TOTAL                                                                   $316.05

Enter fullscreen mode Exit fullscreen mode

You can see the numbers, but not the relationships. The NAT gateway costs $32/month — but is it serving one subnet or eight? The RDS instance at $185/month — what's connected to it, and could you downsize it without breaking the data pipeline? The table doesn't tell you.

A visual overlay does. You see the RDS instance sitting inside its private subnet, connected to the application servers and the analytics Lambda. You see the NAT gateway at the boundary of the public subnet serving the entire private tier. Cost becomes architectural context, not just numbers.

Step-by-step: generate and overlay

  1. Install Infracost

    brew install infracost # macOS # or curl -fsSL https://raw.githubusercontent.com/infracost/infracost/master/scripts/install.sh | sh infracost auth login # free account needed for cost data

  2. Run the breakdown and save JSON

    infracost breakdown --path . --format json > infracost.json

    For a specific Terraform module: infracost breakdown --path ./modules/networking --format json > infracost.json For Terragrunt: infracost breakdown --path . --terragrunt-flags="--terragrunt-working-dir ." --format json > infracost.json

  3. Generate your architecture diagram Open infrasketch.cloud, paste your Terraform HCL (or plan JSON for the most accurate results), and click Generate Diagram.

  4. Open the Cost overlay In the export bar at the bottom of the page, click the 💰 Cost button. A modal opens with a textarea.

  5. Paste the Infracost JSON and apply Copy the contents of infracost.json, paste into the textarea, and click Apply. Cost pills appear on every resource that Infracost priced.

Reading the cost colour scale

Each node gets a pill badge at its bottom centre showing the monthly cost estimate. The colour indicates cost tier:

Free / $0
<$10/mo
$10–$100/mo
$100–$500/mo

$500/mo

Resources with no cost data (e.g., IAM roles, security groups, Route 53 records) don't get a badge. Resources Infracost estimates as free (Lambda free tier, CloudWatch basic metrics) get a grey "Free" pill.

Hover over any pill to see the cost breakdown by component. For example, an RDS instance might show:

aws_db_instance.postgres
Database instance (db.t3.medium): $60.74/mo
Storage (gp2, 100GB): $11.50/mo
Backup storage: $0.00/mo

Enter fullscreen mode Exit fullscreen mode

This tells you exactly which component is driving cost — useful when deciding between instance types or storage tiers.

Common cost patterns to spot in the diagram

The hidden NAT gateway cost

NAT gateways often appear as a single small node in the architecture but carry significant cost: $0.045/GB data processed plus the hourly charge. In the diagram, a yellow/orange NAT gateway node connected to dozens of private resources immediately flags a potential optimization — could some of those services use VPC endpoints (free) instead?

Idle or over-provisioned compute

An EC2 cluster with red-tier cost badges ($500+/mo) that's only connected to a dev database and a single Lambda is a red flag. The spatial context makes over-provisioning obvious in a way that the cost table alone doesn't.

Cascading storage costs

S3 buckets, EBS volumes attached to EC2 instances, and RDS storage often combine to form a significant portion of the bill. When you see multiple amber/orange storage nodes grouped in the same subnet, you can immediately identify candidates for lifecycle policies or right-sizing.

Multi-AZ vs single-AZ databases

A Multi-AZ RDS setup doubles the instance cost. In the diagram, both the primary and standby show up as nodes. If the standby has a red cost badge and your app is internal-only, that's a candidate for a discussion about RTO/RPO tradeoffs vs. cost.

Combining with the security overlay

InfraSketch supports both the Checkov security overlay (🛡) and the Infracost cost overlay (💰) simultaneously. Security badges appear top-right, cost pills appear bottom-centre — no overlap.

The most actionable pattern is a resource that's both expensive and misconfigured: orange/red cost pill plus a red security border. That's a double priority — it's costing you money and creating compliance risk.

Conversely, a resource with many security failures but a "Free" cost pill might be lower priority to fix urgently — though you should still fix it. The combined view helps teams triage when they have limited sprint capacity.

Using Infracost in CI for cost-aware PR reviews

Infracost has a native GitHub Action that posts cost diffs on pull requests. Combine it with the InfraSketch GitHub Action for full cost-and-architecture visibility on every IaC PR:

# .github/workflows/iac-review.yml
name: IaC Review
on:
pull_request:
paths: ['**/*.tf']

jobs:
diagram:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: pandey-raghvendra/infrasketch@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

cost:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: infracost/actions/setup@v3
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
- run: infracost diff --path . --format json --out-file infracost.json
- uses: infracost/actions/comment@v3
with:
path: infracost.json
behavior: update

Enter fullscreen mode Exit fullscreen mode

The InfraSketch job posts diagram links for changed files. The Infracost job posts a cost diff table showing exactly how much the PR changes the monthly bill. Reviewers see both — architecture impact and cost impact — without leaving the PR page.

Note: the Infracost GitHub Action requires an INFRACOST_API_KEY secret (free account at infracost.io). The InfraSketch Action requires only the built-in GITHUB_TOKEN.

Supported Terraform patterns

HCL files

The simplest case: paste one or more .tf files into InfraSketch, run Infracost against the same directory, and overlay. Resource names match directly since both tools read the same HCL.

Terraform plan JSON (most accurate)

For accurate cost estimates — especially when your code uses count, for_each, or variable values — use plan JSON for both tools:

# Generate plan JSON
terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json

# Diagram: paste tfplan.json into InfraSketch
# Cost: point Infracost at the plan
infracost breakdown --path tfplan.json --format json > infracost.json

Enter fullscreen mode Exit fullscreen mode

This gives Infracost the resolved resource counts (e.g., 3 EC2 instances from a count = 3 expression) and gives InfraSketch the same expanded resource list. Matching is more accurate.

Terragrunt

infracost breakdown --path . --format json > infracost.json

Enter fullscreen mode Exit fullscreen mode

Infracost detects Terragrunt automatically. For the diagram, paste the underlying .tf files (not terragrunt.hcl) or use plan JSON.

Troubleshooting

No cost pills appear

Check that you pasted the full JSON (starting with {"version":). Infracost's JSON format starts with a version field and a projects array. If you pasted the summary output instead of the JSON, it won't parse.

Also verify: run cat infracost.json | python3 -m json.tool to confirm it's valid JSON. If Infracost errored silently, it may have written an empty or partial file.

Some resources have pills, others don't

Infracost only prices resources with a known pricing model. IAM roles, security groups, VPCs, subnets, route tables, and many other resources are free in AWS and won't appear in Infracost's output — so they won't get a pill. This is expected behaviour.

Resource names don't match

If you generated the diagram from plan JSON but ran Infracost on raw HCL (or vice versa), resource names may differ. Plan JSON includes module paths in resource names. Run both tools on the same input format for best matching.

Costs look wrong

Infracost estimates are based on on-demand pricing in the region detected from your Terraform config. Reserved instance pricing, Savings Plans, enterprise discounts, and free tier credits are not included by default. The estimates are a useful relative comparison between resources, not an exact billing forecast.

Frequently asked questions

Does InfraSketch send my cost data to any server?

No. The Infracost JSON is parsed entirely in your browser in JavaScript. No data is transmitted anywhere. Your infrastructure cost breakdown stays private.

Do I need an Infracost account to use the overlay?

You need an Infracost account (free) to run infracost breakdown — it calls the Infracost API to fetch cloud pricing data. You don't need any account to use InfraSketch or its cost overlay. Just paste the JSON output InfraSketch generates.

Can the overlay show hourly costs instead of monthly?

Not currently. The pill shows monthly cost, which is the standard unit for comparing infrastructure spend. Hover on the pill to see the components breakdown, which is also monthly.

Does it work with AWS CDK, CloudFormation, or Bicep?

Infracost natively supports Terraform and Terragrunt. For CDK and CloudFormation, Infracost has experimental support via the --format=cloudformation flag. For Bicep (Azure), there's no native Infracost support yet — the azure-cost CLI or Azure Cost Management export can serve a similar purpose, but InfraSketch's overlay only parses Infracost's JSON schema.

What if my infrastructure spans multiple Terraform workspaces or accounts?

Run Infracost separately for each workspace and merge the outputs using infracost output --path infra1.json --path infra2.json --format json > merged.json. Paste the merged JSON into InfraSketch for a combined overlay.

Can I keep the cost overlay when exporting to PNG or SVG?

Yes. Export PNG or SVG with the overlay active — cost pills are rendered into the export. This is useful for attaching to Confluence pages, architecture review docs, or FinOps reports. The share link encodes the diagram structure but not the overlay state.

Try the cost overlay now Generate your architecture diagram and see monthly costs per resource — free, no login, nothing leaves your browser. Open InfraSketch →

Related guides