Retrieving AWS S3 bucket policy in pretty json format.
aws \
--profile AWS_PROFILE \
s3api get-bucket-policy \
--bucket AWS_S3_BUCKET \
--query Policy --output text | jq .
You can try the following:
aws s3api get-bucket-policy \
--bucket <AWS_S3_BUCKET> \
--query Policy --output text --profile la | jq
Example output:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<bucket-name>/*"
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With