Skip to content

Instantly share code, notes, and snippets.

@xiaket
Last active November 15, 2024 09:58
Show Gist options
  • Select an option

  • Save xiaket/b16623765e11a657cbe52b61f1aeda8d to your computer and use it in GitHub Desktop.

Select an option

Save xiaket/b16623765e11a657cbe52b61f1aeda8d to your computer and use it in GitHub Desktop.
ECR Lifecycle Policy example with explanations
{
"rules": [
{
"rulePriority": 10,
"description": "For `latest` tag, keep last 5 images",
"selection": {
"tagStatus": "tagged",
"tagPrefixList": ["latest"],
"countType": "imageCountMoreThan",
"countNumber": 5
},
"action": { "type": "expire" }
},
{
"rulePriority": 20,
"description": "For `master` tag, keep last 5 images",
"selection": {
"tagStatus": "tagged",
"tagPrefixList": ["master"],
"countType": "imageCountMoreThan",
"countNumber": 5
},
"action": { "type": "expire" }
},
{
"rulePriority": 990,
"description": "Only keep untagged images for 7 days",
"selection": {
"tagStatus": "untagged",
"countType": "sinceImagePushed",
"countUnit": "days",
"countNumber": 7
},
"action": { "type": "expire" }
},
{
"rulePriority": 1000,
"description": "Only keep tagged images for 15 days",
"selection": {
"tagStatus": "any",
"countType": "sinceImagePushed",
"countUnit": "days",
"countNumber": 15
},
"action": { "type": "expire" }
}
]
}
@xiaket
Copy link
Copy Markdown
Author

xiaket commented Aug 27, 2020

What do you mean under protected ones? Which images are protected and by whom?

The protected ones are those listed in 1 and 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment