Last active
April 4, 2016 17:32
-
-
Save jkordish/eb1df72433feb209eb3a to your computer and use it in GitHub Desktop.
Add resource to bucket policy
This file contains hidden or 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
# Add an ARN to existing statement | |
policy=$(aws s3api get-bucket-policy --bucket <bucket> --query Policy --output text | jq '.Statement[0].Principal.AWS |= [.][]+ ["<resource arn>"]') | |
# push changes | |
aws s3api put-bucket-policy --bucket <bucket> --policy "${policy}" | |
### | |
# Merge statement lists from remote to your local (policy.json) | |
policy=$(aws s3api get-bucket-policy --bucket <bucket> --query Policy --output text | jq ".Statement |= .+ $(jq .Statement policy.json)") | |
# push changes | |
aws s3api put-bucket-policy --bucket <bucket> --policy "${policy}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment