interface LifecycleRule
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ECR.LifecycleRule |
Java | software.amazon.awscdk.services.ecr.LifecycleRule |
Python | aws_cdk.aws_ecr.LifecycleRule |
TypeScript (source) | @aws-cdk/aws-ecr » LifecycleRule |
An ECR life cycle rule.
Example
declare const repository: ecr.Repository;
repository.addLifecycleRule({ tagPrefixList: ['prod'], maxImageCount: 9999 });
repository.addLifecycleRule({ maxImageAge: Duration.days(30) });
Properties
| Name | Type | Description |
|---|---|---|
| description? | string | Describes the purpose of the rule. |
| max | Duration | The maximum age of images to retain. The value must represent a number of days. |
| max | number | The maximum number of images to retain. |
| rule | number | Controls the order in which rules are evaluated (low to high). |
| tag | string[] | Select images that have ALL the given prefixes in their tag. |
| tag | Tag | Select images based on tags. |
description?
Type:
string
(optional, default: No description)
Describes the purpose of the rule.
maxImageAge?
Type:
Duration
(optional)
The maximum age of images to retain. The value must represent a number of days.
Specify exactly one of maxImageCount and maxImageAge.
maxImageCount?
Type:
number
(optional)
The maximum number of images to retain.
Specify exactly one of maxImageCount and maxImageAge.
rulePriority?
Type:
number
(optional, default: Automatically assigned)
Controls the order in which rules are evaluated (low to high).
All rules must have a unique priority, where lower numbers have higher precedence. The first rule that matches is applied to an image.
There can only be one rule with a tagStatus of Any, and it must have the highest rulePriority.
All rules without a specified priority will have incrementing priorities automatically assigned to them, higher than any rules that DO have priorities.
tagPrefixList?
Type:
string[]
(optional)
Select images that have ALL the given prefixes in their tag.
Only if tagStatus == TagStatus.Tagged
tagStatus?
Type:
Tag
(optional, default: TagStatus.Tagged if tagPrefixList is given, TagStatus.Any otherwise)
Select images based on tags.
Only one rule is allowed to select untagged images, and it must have the highest rulePriority.

.NET
Java
Python
TypeScript (