interface LifecycleRule
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECR.LifecycleRule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecr#LifecycleRule |
Java | software.amazon.awscdk.services.ecr.LifecycleRule |
Python | aws_cdk.aws_ecr.LifecycleRule |
TypeScript (source) | aws-cdk-lib » 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 patterns in their tag. |
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.
tagPatternList?
Type:
string[]
(optional)
Select images that have ALL the given patterns in their tag.
There is a maximum limit of four wildcards () per string. For example, ["test123", "test123"] is valid but ["test12345*6"] is invalid.
Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
tagPrefixList?
Type:
string[]
(optional)
Select images that have ALL the given prefixes in their tag.
Both tagPrefixList and tagPatternList cannot be specified together in a rule.
Only if tagStatus == TagStatus.Tagged
tagStatus?
Type:
Tag
(optional, default: TagStatus.Tagged if tagPrefixList or tagPatternList 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.