Skip to content

Instantly share code, notes, and snippets.

@kmcquade
Last active May 29, 2022 17:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmcquade/c6f1c942079e6fabe836d1f51303f452 to your computer and use it in GitHub Desktop.
Save kmcquade/c6f1c942079e6fabe836d1f51303f452 to your computer and use it in GitHub Desktop.
The Policy below prevents the account from self-managing container images. Users and Roles in the account cannot upload any container images unless the registry is owned by an approved ECR account ID.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PreventSelfManagedImages",
"Action": [
"ecr:BatchDeleteImage",
"ecr:CompleteLayerUpload",
"ecr:Create*",
"ecr:Delete*",
"ecr:Initiate*",
"ecr:Put*",
"ecr:Set*",
"ecr:Start*",
"ecr:Upload*"
],
"Effect": "Deny",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:PrincipalAccount": ["approved_ecr_account_id"]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment