aws-cdk.aws-ecr
The CDK Construct Library for AWS::ECR
What it is and what it does
This package provides Python constructs for AWS CDK v1 that let you define Amazon ECR repositories and configure their behavior declaratively. It abstracts the low-level CloudFormation resources into higher-level objects, so you can create repositories, enable image scanning on push, set tag immutability, configure encryption with KMS keys, and define lifecycle rules to clean up old images—all in Python code alongside the rest of your infrastructure.
The package depends on aws-cdk.core, constructs, jsii, and several other AWS CDK modules to integrate ECR management into a broader CDK application. It supports Python 3.7 through 3.11 and is typed. However, AWS CDK v1 reached end-of-support on 2023-06-01 and is no longer receiving updates; new projects should use AWS CDK v2 instead.
Use it for:
- Define ECR repositories in a CDK stack and automatically enable image scanning on push to catch vulnerabilities.
- Set up lifecycle rules to automatically delete untagged or old images, reducing storage costs and clutter.
- Configure KMS encryption for ECR repositories using either AWS-managed or customer-managed keys.
- Grant IAM users permission to retrieve authorization tokens for Docker CLI authentication to ECR.
- Set tag immutability on repositories to prevent accidental overwrites of production image tags.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides AWS CDK constructs for defining, configuring, and managing Amazon Elastic Container Registry repositories and related resources as infrastructure code.
No—not for new projects. This is AWS CDK v1, which reached end-of-support on 2023-06-01 and is no longer being updated. AWS recommends migrating to AWS CDK v2. Install only if you are maintaining an existing CDK v1 codebase and need ECR constructs; otherwise, use the v2 equivalent.
Install
aws-cdk-aws-ecr on PyPI
pip
pip install aws-cdk-aws-ecruv
uv add aws-cdk-aws-ecrpoetry
poetry add aws-cdk-aws-ecrInstalling aws-cdk.aws-ecr
Before you install
Low install friction with a wheel distribution. Maintenance status is active, though the package is part of AWS CDK v1, which reached end-of-support on 2023-06-01 and is no longer being updated; migration to AWS CDK v2 is recommended.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions.
Quickstart
pip install aws-cdk.aws-ecr
import aws_cdk.aws_ecr as ecr
repository = ecr.Repository(self, "Repository", image_scan_on_push=True)
Requires AWS CDK v1 runtime dependencies (aws-cdk.core, constructs, jsii, and others); AWS CDK v1 is end-of-support as of 2023-06-01.
Verify before relying
- Whether existing AWS CDK v1 projects can coexist with v2 in the same environment without conflicts.
- Performance impact of enabling image_scan_on_push on repository creation and push operations.
- Exact KMS key permissions required when using customer-managed encryption keys.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (~=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — aws-cdk.aws-events, aws-cdk.aws-iam, aws-cdk.aws-kms, aws-cdk.core, constructs, jsii, publication, typeguard |
| Maintenance | actively maintained — 1,152 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 171,314/month — #10,373 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-1.204.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
aws-cdk.aws-apprunner-alphaProvides AWS CDK constructs for deploying…
permissive · top 15,000 on PyPI
aws-cdk.aws-dynamodbProvides AWS CDK constructs for defining,…
permissive · top 15,000 on PyPI
cdk-ecr-deploymentA CDK construct that copies Docker images…
permissive · top 15,000 on PyPI
aws-cdk.aws-ecr-assetsBundles Docker images as AWS CDK assets,…
permissive · top 15,000 on PyPI
aws-cdk.aws-codecommitProvides AWS CDK constructs for creating and…
permissive · top 15,000 on PyPI
aws-cdk.aws-s3tables-alphaProvides AWS CDK constructs for defining and…
permissive · top 15,000 on PyPI
aws-cdk.aws-efsProvides CDK constructs to define Amazon EFS…
permissive · top 15,000 on PyPI
aws-cdk.aws-secretsmanagerAWS CDK construct library for provisioning and…
permissive · top 15,000 on PyPI
aws-cdk.aws-sqsProvides AWS CDK constructs for defining Amazon…
permissive · top 15,000 on PyPI
aws-cdk.aws-kmsProvides AWS CDK constructs for defining and…
permissive · top 15,000 on PyPI