Forrest logo
back to the cdk tool

cdk:tldr:3e02a

cdk: Compare the specified stack with the deployed stack or a local CloudFormation template.
$ cdk diff ${stack_name}
try on your machine

The cdk diff command is a command-line tool provided by the AWS Cloud Development Kit (CDK) that is used to compare the current state of your AWS infrastructure with the desired state defined in your CDK code.

In the command cdk diff ${stack_name}, ${stack_name} represents the name of the CDK stack you want to compare. A CDK stack is a collection of AWS resources, such as EC2 instances, S3 buckets, or Lambda functions, defined in your CDK code.

When you run cdk diff ${stack_name}, the CDK compares the current state of the AWS resources defined in your CDK stack with the desired state defined in your CDK code. It then generates a report that highlights the differences between the two states.

The report generated by cdk diff includes information about additions, modifications, or deletions of resources. It also provides details on the changes to resource properties. This helps you understand the impact of the changes you have made to your CDK code before deploying them to AWS.

By running cdk diff before deploying your CDK code, you can review and validate the changes that will be applied to your AWS infrastructure, allowing you to catch any potential issues or unintended consequences before they happen.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the cdk tool