How to CDK Deploy Without the Prompt for Approval


Borislav Hadzhiev

Sun Apr 18 20211 min read

Deploying your CDK Stack without being asked for Approval #

By default, when we run the cdk deploy command, the CDK CLI checks whether we have made changes to any IAM statements or security group rules, if that's the case it asks us to confirm the deployment.

ask approval

In order to cdk deploy without being prompted for approval we have to add the --require-approval flag to the command and set the approval level to never.

npx cdk deploy --require-approval never

Alternatively we can set the configuration in the cdk.json file in the root directory of our project:

{ "app": "npx ts-node --prefer-ts-exts bin/app.ts", "requireApproval": "never", "context": { // ... rest } }

By setting the --require-approval flag to never, the CDK CLI will not ask us for approval regardless of the changes we make to IAM resources.

require approval never

Further Reading #

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