Skip to content

Instantly share code, notes, and snippets.

@amith23
Created September 11, 2021 04:33
Show Gist options
  • Save amith23/fec816419c20c950f04c9bd2f33def9b to your computer and use it in GitHub Desktop.
Save amith23/fec816419c20c950f04c9bd2f33def9b to your computer and use it in GitHub Desktop.
Sample IAM policy to restrict access to code commit branch
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"codecommit:GitPush",
"codecommit:DeleteBranch",
"codecommit:PutFile",
"codecommit:MergePullRequestByFastForward"
],
"Resource": "arn:aws:codecommit:us-east-2:xxxxxxx:reponame",
"Condition": {
"StringEqualsIfExists": {
"codecommit:References": [
"refs/heads/master"
]
},
"Null": {
"codecommit:References": false
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment