How to get JSON Output from CDK Synth in AWS CDK

avatar

Borislav Hadzhiev

Sat Apr 17 20211 min read

Getting JSON Output from CDK Synth #

The cdk synth command outputs the CloudFormation equivalent of our CDK stack and stores the template as json in the cdk.out directory.

However, the command's output to the terminal is in yaml format.

In order to output JSON from the cdk synth command we have to add the --json flag.

shell
npx cdk synth --json

Issuing the command on a CDK stack, that consists of a single S3 bucket shows the following output:

cdk synth json output

Further Reading #

Add me on LinkedIn

I'm a Web Developer with TypeScript, React.js, Node.js and AWS experience.

Let's connect on LinkedIn

Join my newsletter

I'll send you 1 email a week with links to all of the articles I've written that week

Buy Me A Coffee