cdk publish-assets - AWS Cloud Development Kit (AWS CDK) v2

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 publish-assets

Important

The cdk publish-assets command is in development for the AWS CDK. The current features of this command are subject to change. Therefore, you must opt in by providing the --unstable=publish-assets option to use this command.

Publish assets such as Docker images and file assets for the specified AWS Cloud Development Kit (AWS CDK) stack to their respective destinations, such as Amazon Elastic Container Registry (Amazon ECR) repositories and Amazon Simple Storage Service (Amazon S3) buckets, without performing a deployment.

This command is useful in CI/CD pipelines where you want to separate the asset publishing phase from the deployment phase. By publishing assets independently, you can validate that all assets are built and available before you start the deployment process.

Usage

$ cdk publish-assets <arguments> <options>

Arguments

CDK stack ID

The construct ID of the CDK stack from your app to publish assets for.

Type: String

Required: No

Options

For a list of global options that work with all CDK CLI commands, see Global options.

--all <BOOLEAN>

Publish assets for all stacks in your CDK app.

Default value: false

--concurrency <NUMBER>

Specify the maximum number of simultaneous asset publishing operations to perform.

Default value: 4

--exclusively, -e <BOOLEAN>

Only publish assets for requested stacks and don’t include dependencies.

--force <BOOLEAN>

Re-publish all assets, even if they already exist at the destination.

Default value: false

--help, -h <BOOLEAN>

Show command reference information for the cdk publish-assets command.

Examples

Publish assets for a specific stack

$ cdk publish-assets MyStack --unstable=publish-assets

Publish assets for all stacks

$ cdk publish-assets --all --unstable=publish-assets

Force re-publish assets that already exist

$ cdk publish-assets MyStack --unstable=publish-assets --force

Publish assets then deploy separately

First, publish assets for your stack:

$ cdk publish-assets MyStack --unstable=publish-assets

Then, deploy the stack:

$ cdk deploy MyStack