Skip to content

Instantly share code, notes, and snippets.

@brianwhigham
Created April 3, 2018 12:54
Show Gist options
  • Save brianwhigham/6905e16602a8f0f3cb66bd747b6c16ce to your computer and use it in GitHub Desktop.
Save brianwhigham/6905e16602a8f0f3cb66bd747b6c16ce to your computer and use it in GitHub Desktop.
cloudformation resource to create an ECR Repo with a lifecycle policy
"ECRRepo": {
"Type" : "AWS::ECR::Repository",
"Properties" : {
"LifecyclePolicy" : {
"LifecyclePolicyText" : "{ \"rules\": [ { \"rulePriority\": 10, \"description\": \"remove untagged images except the latest one\", \"selection\": { \"tagStatus\": \"untagged\", \"countType\": \"imageCountMoreThan\", \"countNumber\": 1 }, \"action\": { \"type\": \"expire\" } } ] }"
},
"RepositoryName" : { "Ref": "StackName" }
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment