Retroactively Setting a Whole S3 Bucket to Public

I uploaded a bunch of files to an s3 bucket, then needed to update the permissions.

aws s3 ls --profile <profile> --recursive s3://<bucket>  | awk '{print $NF}' \
| xargs -I{} -n1 aws s3api put-object-acl --profile <profile> --acl public-read --bucket <bucket> --key {}

There’s two replacements in the above code you need to make:

  • bucket - the name of the bucket
  • profile - the profile configured in ~/.aws/credentials

There’s a better explanation here, in the AWS support documentation



#aws #s3 #work