This is the AWS CDK v2 Developer Guide. The older CDK v1 entered maintenance on June 1, 2022 and ended support on June 1, 2023.
cdk rollback
Use the AWS Cloud Development Kit (AWS CDK) Command Line Interface (CLI) cdk rollback command to rollback a failed or paused stack from an AWS CloudFormation deployment to its last stable state.
Note
To use this command, you must have v23 of the bootstrap template deployed to your environment. For more information, see Bootstrap template version history.
When you deploy using cdk deploy, the CDK CLI will rollback a failed deployment by default. If you specify --no-rollback with cdk deploy, you can then use the cdk rollback command to manually rollback a failed deployment. This will initiate a rollback to the last stable state of your stack.
Usage
$ cdk rollback <arguments> <options>
Arguments
- CDK stack ID
-
The construct ID of the CDK stack from your app to rollback.
Type: String
Required: No
Options
For a list of global options that work with all CDK CLI commands, see Global options.
-
--all <BOOLEAN> -
Rollback all stacks in your CDK app.
Default value:
false
-
--force, -f <BOOLEAN> -
When you use
cdk rollback, some resources may fail to rollback. Provide this option to force the rollback of all resources. This is the same behavior as providing the--orphanoption for each resource in your stack.Default value:
false
-
--help, -h <BOOLEAN> -
Show command reference information for the
cdk rollbackcommand.
-
--orphan <LogicalId> -
When you use
cdk rollback, some resources may fail to rollback. When this happens, you can try to force the rollback of a resource by using this option and providing the logical ID of the resource that failed to rollback.This option can be provided multiple times in a single command The following is an example:
$ cdk rollback MyStack --orphan MyLambdaFunction --orphan MyLambdaFunction2To force the rollback of all resources, use the
--forceoption instead.
-
--toolkit-stack-name <STRING> -
The name of the existing CDK Toolkit stack that the environment is bootstrapped with.
By default,
cdk bootstrapdeploys a stack namedCDKToolkitinto the specified AWS environment. Use this option to provide a different name for your bootstrap stack.The CDK CLI uses this value to verify your bootstrap stack version.
-
--validate-bootstrap-version <BOOLEAN> -
Specify whether to validate the bootstrap stack version. Provide
--validate-bootstrap-version=falseor--no-validate-bootsrap-versionto turn off this behavior.Default value:
true