AWS Fundamentals LogoAWS Fundamentals
Back to Blog

CDK Diff is underrated

Sandro Volpicella
by Sandro Volpicella
CDK Diff is underrated

Table of Contents

Jump to a section

CDK Diff is underrated

I think it is often very underrated to use an IAC diffing tool like with CDK cdk diff. Let's have a look what that is doing exactly and why it is useful.

The 5 minutes I spend running CDK diff have saved me days of rollbacks and late-night debugging sessions.

CDK Diff in action

In smaller projects it is quite easy to understand what happens once you make a change

You deploy a new queue, a lambda function, some IAM permissions, and done.

But once your project becomes a bit more complex (or on projects you didn't create from scratch) one little change can have a large impact.

Sometimes you accidentally change an IAM permission which you shouldn't.

Sometimes, you forgot that the "small" rename will actually recreate your bucket. And sometimes you just increased your cost dramatically without realizing.

CDK diff can give you assurance on that.

AWS Lambda Infographic

AWS Lambda on One Page (No Fluff)

Skip the 300-page docs. Our Lambda cheat sheet covers everything from cold starts to concurrency limits - the stuff we actually use daily.

HD quality, print-friendly. Stick it next to your desk.

Privacy Policy
By entering your email, you are opting in for our twice-a-month AWS newsletter. Once in a while, we'll promote our paid products. We'll never send you spam or sell your data.

My typical workflow

My typical workflow is:

  1. Checkout main branch
  2. Run cdk diff → no changes (supposed to be)
  3. Make changes on branch
  4. Run cdk diff again → should only show the changes you did
CDK Diff Workflow

Doing this locally is not always possible. If it is not make use of it in PR comments or in the build pipeline.

Next step → Snapshot tests 😉

Related Posts

Discover similar content using semantic vector search powered by AWS S3 Vectors. These posts share conceptual similarities based on machine learning embeddings.

vector_search.sh
~/blog/related-posts
$ aws s3-vectors query --embedding-model titan --index bedrock-kb-default --similarity cosine --top-k 3
✓ Found 3 semantic matches:
[MATCH_1]
cosine_similarity:0.558852
vector_dim: 1536 | euclidean_dist: 0.882
AWS CDK Version 2. What Is It and Why Should We Care?
cover.webp...
AWS CDK Version 2. What Is It and Why Should We Care?
aws_service:cdktimestamp:2022-01-14
slug: /blog/aws-cdk-version-2-what-is-it-and-why-should-we-careembedding_match: 55.89%
[MATCH_2]
cosine_similarity:0.552014
vector_dim: 1536 | euclidean_dist: 0.896
A Comprehensive Guide to AWS Compute Services
cover.webp...
A Comprehensive Guide to AWS Compute Services
aws_service:lambdatimestamp:2023-02-06
slug: /blog/a-comprehensive-guide-to-aws-compute-servicesembedding_match: 55.20%
[MATCH_3]
cosine_similarity:0.535072
vector_dim: 1536 | euclidean_dist: 0.930
Introduction to AWS Lambda: A Starter Guide
cover.webp...
Introduction to AWS Lambda: A Starter Guide
aws_service:lambdatimestamp:2021-05-27
slug: /blog/starter-guide-things-i-wish-i-knew-before-for-aws-lambdaembedding_match: 53.51%
Query executed in ~15ms
Powered by AWS S3 Vectors
$ _

Related Posts

⚡ Powered by AWS S3 Vectors
AWS Lambda Infographic

AWS Lambda on One Page (No Fluff)

Skip the 300-page docs. Our Lambda cheat sheet covers everything from cold starts to concurrency limits - the stuff we actually use daily.

HD quality, print-friendly. Stick it next to your desk.

Privacy Policy
By entering your email, you are opting in for our twice-a-month AWS newsletter. Once in a while, we'll promote our paid products. We'll never send you spam or sell your data.