Building a blast-radius analyzer for CloudFormation, and everything that broke along the way
A four-day solo build that turns CloudFormation templates into interactive dependency graphs. What I learned about intrinsic tags, silent parser failures, and why I switched from Claude to Nova on Bedrock.
I inherited a CloudFormation template last year. Four hundred lines. Twenty-seven resources across VPC, RDS, ALB, Lambda, and IAM. I spent two days reading it before I was willing to change anything, because I had no idea what depended on what.
Every tool I tried answered the wrong question. CloudFormation Change Sets show you what a deploy will change, one hop at a time. cfn-lint validates each resource against the schema, in isolation. Infrastructure Composer renders the graph but doesn't compute impact. Checkov flags misconfigurations resource by resource. All four treat resources as individual objects. None of them walk the dependency chain.
So for the WeMakeDevs First Commit hackathon, I built IaC Visualizer — a tool that parses a CloudFormation template, renders it as an interactive dependency graph, and answers the one question reviewers actually have: if I change this resource, what transitively breaks?
This is what I ran into while building it.
The parser problem nobody warns you about
CloudFormation's
!Ref , !GetAtt , and !Sub are not valid YAML. I knew this in theory. What I didn't know is that every standard YAML parser throws unknown tag !<!Ref> on a real template, which means the first thing you write isn't a parser, it's a workaround for a parser.My first version hand-rolled a
js-yaml schema with sixteen tag definitions. It worked on the fixtures I wrote. It broke on the first real template I tested — !ImportValue with a nested Fn::Sub mapping. Then !FindInMap with three arguments. Every new intrinsic form was a new schema entry, and I was going to be writing schema definitions for the rest of the project.I switched to
js-yaml-cloudformation-schema , which registers every standard CloudFormation tag and converts each to its JSON equivalent. One line. Suddenly real templates parsed.The one filter that decides whether the graph is correct
Here's what took me longer to internalize than anything else: when you walk a template and extract every reference, you have to filter the results against the actual resource list. If you don't,
AWS::StackName becomes a node. AWS::Region becomes a node. Parameter names like ${Environment} become nodes. Condition names like IsProd become nodes.The filter is one line — checking whether the extracted name exists in the set of resource logical IDs — and it's the difference between a correct graph and a graph that looks correct but contains resources that don't exist.
I caught it because one of my fixtures used
!Sub '${AWS::StackName}-data' , and I noticed AWS::StackName showing up as a node in the output. If that fixture hadn't used that pattern, this would have shipped as a silent bug.Fn::GetAtt returns two different shapes
js-yaml-cloudformation-schema returns Fn::GetAtt as a string when you write it as !GetAtt Foo.Arn , but as an array when you write it as !GetAtt [Foo, Arn] . Both forms are valid CloudFormation. Both appear in real templates.My parser only handled the array form. The graph looked correct — no errors, no crashes — but it silently lost every edge created by the string form. My
s3-lambda.yaml fixture produced two edges instead of three, and the missing one was the Lambda's reference to its IAM role.The test suite caught this only because I'd hardcoded the expected edge count. If I'd written
expect(edges.length).toBeGreaterThan(0) instead of expect(edges.length).toBe(3) , the bug would have shipped.Since then I've written every test to assert exact numbers. Wrong output that looks the same as right output is the hardest kind of bug to find, and the only defense is asserting the exact shape you expect.
The rule that started the project
The most interesting piece of the tool is a rule that doesn't exist anywhere else. Given a Lambda that references an S3 bucket through its environment variables, and an execution role that only grants
logs: permissions, the rule fires with severity high. CloudFormation will deploy this cleanly. The Lambda will fail the first time it tries to read the bucket with AccessDenied .cfn-lint can't catch this. Each of the three resources is individually valid. The bug only exists in the relationship between them. To flag it, the tool has to cross-reference the Lambda, what it references, and what its IAM role grants — three separate data structures that must be held in exact alignment.
That rule is why the project exists. The other seven rules are commodity checks. This one isn't.
Bedrock, AISPL, and why I used Nova
The AI layer is Bedrock. The first thing I tried was Claude Haiku, because that was the obvious choice. It didn't work, and the reason is specific to AWS India.
My account is registered under AISPL, AWS India's billing entity. AISPL accounts hit a Marketplace subscription gate when trying to invoke Anthropic models. The error is
INVALID_PAYMENT_INSTRUMENT , which tells you nothing about what actually went wrong. I spent an afternoon thinking I had a billing issue before finding the real cause in an AWS re:Post thread.I switched to Amazon Nova Micro. Nova is a first-party Amazon model — no Marketplace subscription required — and it costs about seven times less. For a task that's fundamentally formatting narration over pre-computed findings, the smaller model is the correct choice anyway. The narration is not reasoning. It's templating with a variable.
The important architectural point is that Bedrock sits downstream of the rule engine. The rules compute the findings. Bedrock explains them. The prompt explicitly instructs the model not to invent new flags and not to second-guess the deterministic output. Same template in, same flags out, every time.
The deploy that failed twice before I understood why
Amplify's build failed twice with
Rolldown failed to resolve import "@dagrejs/dagre" . The package was clearly listed in package.json . I spent an hour assuming it was a Vite configuration issue.It wasn't.
npm ci reads package-lock.json , not package.json . My lockfile was stale from an earlier install and didn't include @dagrejs/dagre . Amplify installed exactly what the lockfile said to install, which was everything except the package I needed.The fix was
rm package-lock.json && npm install and then committing the regenerated lockfile. The lesson is general: if you deploy with npm ci , your lockfile is the source of truth. Commit both. Keep them in sync. A green build on your laptop means nothing if the lockfile drifted.What I'd do differently
The rule engine is eight rules, and seven of them duplicate work that cfn-lint or Checkov already do better. If I did this again, I'd cut those seven and go deeper on the cross-reference pattern that the eighth rule uses. The graph is the interesting part. The rules that check properties in isolation are decoration.
I'd also add a walker depth budget. The current version has a 200 KB input size cap, which closes the obvious YAML-bomb surface, but a small deeply-nested payload could still expand during the property walk. That's a real hardening gap and it's on the roadmap.
Where it is now
The tool is deployed on AWS Lambda behind an API Gateway HTTP API, with the frontend on Amplify. Three Lambda functions, Node 22 on ARM64, deployed via SAM. Bedrock runs Nova Micro for narration. The whole thing costs about two cents a month at demo scale.
There's also a CLI —
iac check template.yaml — that wraps the same analysis engine and returns exit code 1 on high-severity findings. That's the form factor that actually matters for adoption, because a CI pipeline runs without anyone remembering to open a browser.
Built solo for First Commit, WeMakeDevs Bharat Builds Tour, September 2026.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article