Created
January 17, 2020 17:03
-
-
Save cjthorpe/e12e4eef87770b8330cafe01b7a0dcfc to your computer and use it in GitHub Desktop.
Example IAM Policy to Restrict Pushing Directly to Master Branch in CodeCommit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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