How to CDK Deploy Without the Prompt for Approval

avatar

Borislav Hadzhiev

Last updated: Apr 14, 2022

banner

Check out my new book

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.

shell
npx aws-cdk deploy --require-approval never

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

cdk.json
{ "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 #

Use the search field on my Home Page to filter through my more than 3,000 articles.