Gathering detailed insights and metrics for cdk-assets
Gathering detailed insights and metrics for cdk-assets
Gathering detailed insights and metrics for cdk-assets
Gathering detailed insights and metrics for cdk-assets
@aws-cdk/assets
This module is deprecated. All types are now available under the core module
@aws-cdk/aws-ecr-assets
Docker image assets deployed to ECR
@aws-cdk/aws-s3-assets
Deploy local files and directories to S3
@aws-cdk/cdk-assets-schema
Schema definition for the Asset Manifest
npm install cdk-assets
Typescript
Module System
Min. Node Version
Node Version
NPM Version
@aws-cdk/cloud-assembly-schema@v45.2.0
Updated on Jul 07, 2025
cdk-assets@v4.0.2
Updated on Jul 07, 2025
@aws-cdk/cdk-assets-lib@v1.0.1
Updated on Jul 07, 2025
@aws-cdk/cli-lib-alpha@v2.1020.2-alpha.0
Updated on Jul 03, 2025
@aws-cdk/cloud-assembly-schema@v45.1.0
Updated on Jul 03, 2025
aws-cdk@v2.1020.2
Updated on Jul 03, 2025
TypeScript (97.54%)
JavaScript (1.37%)
Shell (0.39%)
Go (0.23%)
Java (0.16%)
Python (0.13%)
C# (0.11%)
Batchfile (0.02%)
F# (0.02%)
Dockerfile (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
68 Stars
458 Commits
35 Forks
9 Watchers
50 Branches
65 Contributors
Updated on Jul 11, 2025
Latest Version
4.0.2
Package Id
cdk-assets@4.0.2
Unpacked Size
9.35 MB
Size
1.41 MB
File Count
17
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jul 07, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
28
A tool for publishing CDK assets to AWS environments.
cdk-assets
requires an asset manifest file called assets.json
, in a CDK
CloudAssembly (cdk.out/assets.json
). It will take the assets listed in the
manifest, prepare them as required and upload them to the locations indicated in
the manifest.
Currently the following asset types are supported:
S3 buckets and ECR repositories to upload to are expected to exist already.
We expect assets to be immutable, and we expect that immutability to be reflected both in the asset ID and in the destination location. This reflects itself in the following behaviors:
For assets build by external utilities, the contract is such that cdk-assets expects the utility to manage dedupe detection as well as path/image tag generation. This means that cdk-assets will call the external utility every time generation is warranted, and it is up to the utility to a) determine whether to do a full rebuild; and b) to return only one thing on stdout: the path to the file/archive asset, or the name of the local Docker image.
The cdk-asset
tool is a CLI. Use library
access if you need more
control over authentication than the default AWS SDK for JavaScript
v3 implementation allows.
Command-line use looks like this:
1$ cdk-assets /path/to/cdk.out [ASSET:DEST] [ASSET] [:DEST] [...]
Credentials will be taken from the AWS_ACCESS_KEY...
environment variables
or the default
profile (or another profile if AWS_PROFILE
is set).
A subset of the assets and destinations can be uploaded by specifying their asset IDs or destination IDs.
An asset manifest looks like this:
1{ 2 "version": "1.22.0", 3 "files": { 4 "7aac5b80b050e7e4e168f84feffa5893": { 5 "source": { 6 "path": "some_directory", 7 "packaging": "zip" 8 }, 9 "destinations": { 10 "us-east-1": { 11 "region": "us-east-1", 12 "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account", 13 "bucketName": "MyBucket", 14 "objectKey": "7aac5b80b050e7e4e168f84feffa5893.zip" 15 } 16 } 17 }, 18 "3dfe2b80b050e7e4e168f84feff678d4": { 19 "source": { 20 "executable": ["myzip"] 21 }, 22 "destinations": { 23 "us-east-1": { 24 "region": "us-east-1", 25 "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account", 26 "bucketName": "MySpecialBucket", 27 "objectKey": "3dfe2b80b050e7e4e168f84feff678d4.zip" 28 } 29 } 30 } 31 }, 32 "dockerImages": { 33 "b48783c58a86f7b8c68a4591c4f9be31": { 34 "source": { 35 "directory": "dockerdir" 36 }, 37 "destinations": { 38 "us-east-1": { 39 "region": "us-east-1", 40 "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account", 41 "repositoryName": "MyRepository", 42 "imageTag": "b48783c58a86f7b8c68a4591c4f9be31", 43 "imageUri": "123456789012.dkr.ecr.us-east-1.amazonaws.com/MyRepository:1234567891b48783c58a86f7b8c68a4591c4f9be31" 44 } 45 } 46 }, 47 "d92753c58a86f7b8c68a4591c4f9cf28": { 48 "source": { 49 "executable": ["mytool", "package", "dockerdir"] 50 }, 51 "destinations": { 52 "us-east-1": { 53 "region": "us-east-1", 54 "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account", 55 "repositoryName": "MyRepository2", 56 "imageTag": "d92753c58a86f7b8c68a4591c4f9cf28", 57 "imageUri": "123456789987.dkr.ecr.us-east-1.amazonaws.com/MyRepository2:1234567891b48783c58a86f7b8c68a4591c4f9be31" 58 } 59 } 60 } 61 } 62}
The destination
block of an asset manifest may contain the following region
and account placeholders:
${AWS::Region}
${AWS::AccountId}
These will be substituted with the region and account IDs currently configured
on the AWS SDK (through environment variables or ~/.aws/...
config files).
${AWS::AccountId}
placeholder will not be re-evaluated after
performing the AssumeRole
call.${AWS::Region}
is used, it will principally be replaced with the value
in the region
key. If the default region is intended, leave the region
key out of the manifest at all.For Docker image asset publishing, cdk-assets
will docker login
with
credentials from ECR GetAuthorizationToken prior to building and publishing, so
that the Dockerfile can reference images in the account's ECR repo.
cdk-assets
can also be configured to read credentials from both ECR and
SecretsManager prior to build by creating a credential configuration at
'~/.cdk/cdk-docker-creds.json' (override this location by setting the
CDK_DOCKER_CREDS_FILE environment variable). The credentials file has the
following format:
1{ 2 "version": "1.0", 3 "domainCredentials": { 4 "domain1.example.com": { 5 "secretsManagerSecretId": "mySecret", // Can be the secret ID or full ARN 6 "roleArn": "arn:aws:iam::0123456789012:role/my-role" // (Optional) role with permissions to the secret 7 }, 8 "domain2.example.com": { 9 "ecrRepository": true, 10 "roleArn": "arn:aws:iam::0123456789012:role/my-role" // (Optional) role with permissions to the repo 11 } 12 } 13}
If the credentials file is present, docker
will be configured to use the
docker-credential-cdk-assets
credential helper for each of the domains listed
in the file. This helper will assume the role provided (if present), and then fetch
the login credentials from either SecretsManager or ECR.
By default, the AWS CDK will build and publish Docker image assets using the
docker
command. However, by specifying the CDK_DOCKER
environment variable,
you can override the command that will be used to build and publish your
assets.
No vulnerabilities found.
No security vulnerabilities found.