AWS AmazonS3: Reformat PutBucketPolicy example and link policy docs
Summary
Reformatted the put-bucket-policy CLI example and JSON policy, and added a link to bucket policy guidance.
Security assessment
The added text documents a bucket policy example with public read access and write/delete permissions; this is security-relevant, but the diff is formatting/linking and does not address a specific vulnerability.
Evidence
The following `put-bucket-policy` example allows all users to retrieve any object in _amzn-s3-demo-bucket_ except those in the _MySecretFolder_. It also grants `put` and `delete` permission to the root user of the AWS account `1234-5678-9012`.
Diff
diff --git a/AmazonS3/latest/developerguide/s3_example_s3_PutBucketPolicy_section.md b/AmazonS3/latest/developerguide/s3_example_s3_PutBucketPolicy_section.md index e0aae3d..5666268 100644 --- a//AmazonS3/latest/developerguide/s3_example_s3_PutBucketPolicy_section.md +++ b//AmazonS3/latest/developerguide/s3_example_s3_PutBucketPolicy_section.md @@ -94 +94 @@ CLI -This example allows all users to retrieve any object in _amzn-s3-demo-bucket_ except those in the _MySecretFolder_. It also grants `put` and `delete` permission to the root user of the AWS account `1234-5678-9012`: +**To apply a policy to a bucket** @@ -95,0 +96,9 @@ This example allows all users to retrieve any object in _amzn-s3-demo-bucket_ ex +The following `put-bucket-policy` example allows all users to retrieve any object in _amzn-s3-demo-bucket_ except those in the _MySecretFolder_. It also grants `put` and `delete` permission to the root user of the AWS account `1234-5678-9012`. + + + aws s3api put-bucket-policy \ + --bucket amzn-s3-demo-bucket \ + --policy file://policy.json + + +Contents of `policy.json`: @@ -97 +105,0 @@ This example allows all users to retrieve any object in _amzn-s3-demo-bucket_ ex - aws s3api put-bucket-policy --bucket amzn-s3-demo-bucket --policy file://policy.json @@ -99 +106,0 @@ This example allows all users to retrieve any object in _amzn-s3-demo-bucket_ ex - policy.json: @@ -127,0 +135,3 @@ This example allows all users to retrieve any object in _amzn-s3-demo-bucket_ ex +This command produces no output. + +For more information, see [Bucket policies for Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-policies.html) in the _Amazon S3 User Guide_.