This is the AWS Cloud Development Kit (CDK) v1 construct library for Amazon Elastic Container Registry (ECR). It provides high-level constructs to define ECR resources using familiar programming languages. As of June 1, 2023, AWS CDK v1 has reached End-of-Support, meaning this package is no longer updated, and users are strongly advised to migrate to AWS CDK v2. In v2, ECR constructs are part of the unified `aws-cdk-lib` package.
pip install aws-cdk.aws-ecrVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a basic ECR repository using the `aws-cdk-aws-ecr` (v1) construct. It defines a stack that provisions an ECR repository named 'my-application-images-v1'. It is crucial to note that this is a v1 example, and migration to AWS CDK v2 is strongly recommended.
Migrate your CDK applications to AWS CDK v2. For ECR functionality, use `aws-cdk-lib` and `from aws_cdk import aws_ecr` for imports.
Update your `requirements.txt` to `aws-cdk-lib` and `constructs`, and change import statements from `import aws_cdk.aws_ecr as ecr` to `from aws_cdk import aws_ecr`.
Globally update `aws-cdk` CLI to v2 (`npm install -g aws-cdk@latest`) and re-bootstrap your AWS account (`cdk bootstrap`). Ensure your deployment roles have updated permissions for v2 assets if you use fine-grained access.
Remove most v1 feature flags from `cdk.json` that start with `@aws-cdk/`. A small subset can be set to `false` to revert to specific v1 behaviors if necessary, but review the migration guide carefully.
For CDK v2: Ensure `aws-cdk-lib` is installed (`pip install aws-cdk-lib`) and imports are `from aws_cdk import aws_ecr`. For CDK v1: Ensure `aws-cdk.aws-ecr` is installed (`pip install aws-cdk.aws-ecr`) and imports are `import aws_cdk.aws_ecr as ecr`. Best practice is to migrate to v2.
Run `cdk bootstrap aws://ACCOUNT-ID/REGION` (e.g., `cdk bootstrap aws://123456789012/us-east-1`) to provision or update the modern bootstrap stack. Ensure your `aws-cdk` CLI is updated to v2.
First, ensure your environment is bootstrapped with the latest CDK v2 bootstrap stack (`cdk bootstrap`). If the issue persists, review the specific construct's documentation, as it might require explicit `asset_options` or `bundling` configurations (e.g., `bundling=cdk.BundlingOptions(image=cdk.DockerImage.from_registry("public.ecr.aws/lambda/python:3.9"))`). This can also be a symptom of v1 constructs trying to build assets using v2 CLI, so migration to v2 is the ultimate fix.No resource links recorded.