Skip to content

Instantly share code, notes, and snippets.

@cjthorpe
Created January 17, 2020 17:03
Show Gist options
  • Save cjthorpe/e12e4eef87770b8330cafe01b7a0dcfc to your computer and use it in GitHub Desktop.
Save cjthorpe/e12e4eef87770b8330cafe01b7a0dcfc to your computer and use it in GitHub Desktop.
Example IAM Policy to Restrict Pushing Directly to Master Branch in CodeCommit
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"codecommit:GitPush",
"codecommit:DeleteBranch",
"codecommit:PutFile"
],
"Resource": [
"arn:aws:codecommit:eu-west-2:<account ID>:<example repo name with wildcard>*"
],
"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