Make an S3 Bucket Permissions Public Access to 'Everyone' using CLI

Viewed 1371

How would I set the S3 Bucket Permissions for Public Access to 'Everyone' for Read Files using AWS CLI?

The documentation does not have clear specification of how to do this and have tried multiple variations. My end goal is to make the bucket a static site server bucket.

2 Answers

S3 Bucket ACL permission are set after the bucket is created - I achieved a public file read bucket using this command

aws s3api put-bucket-acl --bucket ${SITE_NAME} --acl public-read

After creating the bucket:

aws s3api create-bucket --bucket ${SITE_NAME} --region ap-southeast-2 --create-bucket-configuration LocationConstraint=ap-southeast-2

Hope the below command will help you to make the s3 object public through the AWS CLI command.

aws s3api put-object-acl --bucket <bucketname> --key <object name with extension> --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers

Related