Last active
April 18, 2019 16:52
-
-
Save nitrocode/41a8d803223991a2e0fa9c2c49926c63 to your computer and use it in GitHub Desktop.
S3 get bucket policy and make the json pretty
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
| aws s3api get-bucket-policy --bucket vici-configs \ | |
| jq .Policy | \ | |
| sed 's/^"\(.*\)"$/\1/' | \ | |
| sed 's/\\//g' | \ | |
| jq | |
| # jq .Policy will get the Policy key of the json | |
| # 1st sed will remove the first and last quotes | |
| # 2nd sed will remove backslashes | |
| # last jq to prettify the json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
jq -rinstead of the firstsed: