skillfed

aws-cdk.aws-ecr-assets

Docker image assets deployed to ECR

aws-cdk-aws-ecr-assets v1.204.0 172.1K downloads/30d#10,347 on PyPI12,868
Permissive license Apache-2.0 Active released

What it is and what it does

This package extends AWS CDK v1 with the ability to package Docker images as first-class assets within your infrastructure-as-code. It handles building images from local Dockerfiles or loading them from tarballs, then automatically uploads them to an AWS-managed ECR repository during deployment. The package integrates with the CDK toolkit and CI/CD pipelines to manage the full lifecycle—from build context preparation (with `.dockerignore` support) through image push and CloudFormation parameter wiring.

The module supports build-time customization via build arguments, target stages, networking modes, and platform selection. Images are referenced in CDK code via `asset.imageUri`, which includes both the ECR URL and tag. Pull permissions are managed through IAM policy grants on the asset's repository, with special handling for cross-account and AWS service consumers.

Use it for:

  • Build and deploy custom Docker images as part of CDK stacks without manual ECR repository management.
  • Package application containers with build arguments and multi-stage Dockerfile targets in infrastructure code.
  • Reference built images in CDK constructs for ECS, Lambda, or other AWS services that consume container images.
  • Automate image versioning and tagging through CDK asset hashing for consistent deployments across environments.
  • Grant pull permissions to ECS tasks, Lambda functions, or cross-account principals via the asset's repository interface.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Bundles Docker images as AWS CDK assets, building from Dockerfiles or tarballs and uploading them to Amazon ECR for use in CDK applications.

No—do not install this package for new projects. AWS CDK v1 reached end-of-support on 2023-06-01 and is no longer being updated. Migrate to AWS CDK v2 instead, which includes the equivalent functionality in `aws-cdk-lib.aws_ecr_assets`. Installing v1 packages exposes you to unpatched security issues and lack of ongoing maintenance.

Install

aws-cdk-aws-ecr-assets on PyPI

pip

pip install aws-cdk-aws-ecr-assets

uv

uv add aws-cdk-aws-ecr-assets

poetry

poetry add aws-cdk-aws-ecr-assets

Installing aws-cdk.aws-ecr-assets

Before you install

Low install friction with a wheel distribution. The package is in active maintenance status but carries a critical caveat: AWS CDK v1 reached end-of-support on 2023-06-01 and is no longer being updated; users should migrate to AWS CDK v2.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions.

Quickstart

from aws_cdk.aws_ecr_assets import DockerImageAsset
import os

asset = DockerImageAsset(self, "MyImage",
    directory=os.path.join(os.path.dirname(__file__), "my-image")
)
image_uri = asset.imageUri

Requires Docker to be installed and running on the build machine; the target directory must contain a Dockerfile.

Verify before relying

  • Whether v1 packages continue to receive security patches despite end-of-support status.
  • Compatibility and migration effort when upgrading from v1 to v2 in existing CDK applications.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (~=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 10 — aws-cdk.assets, aws-cdk.aws-ecr, aws-cdk.aws-iam, aws-cdk.aws-s3, aws-cdk.core, aws-cdk.cx-api, constructs, jsii, publication, typeguard
Maintenance actively maintained — 1,152 days since the last release
Last repo commit
First released
Downloads 172,131/month — #10,347 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aws_cdk.aws_ecr_assets-1.204.0-py3-none-any.whl

Development Status :: 7 - InactiveFramework :: AWS CDKFramework :: AWS CDK :: 1Intended Audience :: DevelopersLicense :: OSI ApprovedOperating System :: OS IndependentProgramming Language :: JavaScriptProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Tags

docker image cdk assetsecr asset bundlingcdk dockerfile deploymentcontainerize cdk infrastructuredocker build ecr pushcdk container imagesecr image assets aws
cdk-v1-eolcontainer-assetsinfrastructure-as-code

More Build Tools packages

packaging

Provides reusable utilities for Python…

permissive · top 100 on PyPI

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

pip

pip is the standard installer for Python…

permissive · top 100 on PyPI

hatchling

Hatchling is a standards-compliant Python build…

permissive · top 100 on PyPI

grpcio-tools

Generates Python gRPC service stubs and message…

permissive · top 1,000 on PyPI

pre-commit

pre-commit is a framework for installing and…

permissive · top 1,000 on PyPI

aws-cdk.aws-s3-assets

Packages local files and directories for…

permissive · top 15,000 on PyPI

cdk-ecr-deployment

A CDK construct that copies Docker images…

permissive · top 15,000 on PyPI

aws-cdk.aws-ecr

Provides AWS CDK constructs for defining,…

permissive · top 15,000 on PyPI

aws-cdk.aws-apprunner-alpha

Provides AWS CDK constructs for deploying…

permissive · top 15,000 on PyPI

aws-cdk.asset-node-proxy-agent-v6

Bundles the NPM proxy-agent package (version…

permissive · top 5,000 on PyPI

aws-cdk.asset-awscli-v1

Bundles AWS CLI v1 as a reusable asset for AWS…

permissive · top 5,000 on PyPI

aws-cdk.asset-node-proxy-agent-v5

Bundles the NPM proxy-agent package as an AWS…

permissive · top 15,000 on PyPI

aws-cdk.aws-s3-deployment

Deploys files and directories to AWS S3 buckets…

permissive · top 15,000 on PyPI

aws-cdk.aws-imagebuilder

Provides AWS CDK L1 constructs for defining and…

permissive · top 15,000 on PyPI

aws-cdk.aws-autoscaling-common

Provides shared internal implementation details…

permissive · top 15,000 on PyPI