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
76.4
Supply Chain
35.7
Quality
92.6
Maintenance
100
Vulnerability
86.2
License
@aws-cdk/cli-lib-alpha@v2.1015.0-alpha.0
Updated on May 14, 2025
@aws-cdk/cloud-assembly-schema@v43.10.0
Updated on May 14, 2025
cdk-assets@v3.2.2
Updated on May 14, 2025
@aws-cdk/cloudformation-diff@v2.181.2
Updated on May 14, 2025
@aws-cdk/cli-plugin-contract@v2.180.2
Updated on May 14, 2025
@aws-cdk/integ-runner@v2.186.7
Updated on May 14, 2025
TypeScript (97.46%)
JavaScript (1.39%)
Shell (0.41%)
Go (0.25%)
Java (0.17%)
Python (0.14%)
C# (0.12%)
F# (0.03%)
Batchfile (0.02%)
Dockerfile (0.01%)
Total Downloads
157,131,123
Last Day
165,478
Last Week
822,426
Last Month
3,075,802
Last Year
34,628,597
Apache-2.0 License
57 Stars
318 Commits
23 Forks
9 Watchers
25 Branches
59 Contributors
Updated on May 14, 2025
Latest Version
3.2.2
Package Id
cdk-assets@3.2.2
Unpacked Size
537.68 kB
Size
146.81 kB
File Count
56
NPM Version
10.9.2
Node Version
22.15.0
Published on
May 14, 2025
Cumulative downloads
Total Downloads
14
31
V3 of cdk-assets is still under active development and is subject to non-backward compatible changes while being released with the
rc
suffix.These changes are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes.
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 can be used programmatically and via the CLI. Use
programmatic 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.
Last Day
12.3%
165,478
Compared to previous day
Last Week
25.8%
822,426
Compared to previous week
Last Month
-0.3%
3,075,802
Compared to previous month
Last Year
17.8%
34,628,597
Compared to previous year