How to make AWS S3 bucket files public

I was having a bit of an issue while working with AWS S3 when I was uploading bunch of images to it and I couldn’t access them in my application or anywhere for that matter. I had to manually change every single one of the files to be public. Now there’s got to be a better way right? Yes there is, there always is. You can set the whole bucket public, but be careful with this as anyone with a link can then access you files. So don’t store super secret stuff in a public AWS S3 bucket.

To set an AWS S3 bucket public follow the step by step guide below.

Step by step

  1. go to you AWS S3 bucket and click on permissions
  2. go to section “Block public access (bucket settings)” and click “Edit
  3. uncheck “Block all public access
  4. go back to AWS S3 bucket permissions
  5. scroll down to section “Bucket policy” and click “Edit
  6. paste the below JSON
  7. change the “Resource” “<bucket_name>” to the name of your bucket
  8. click “Save changes
  9. and you’re DONE!
{
    "Version": "2012-10-17",
    "Id": "Policy1628541614261",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<bucket_name>/*"
        }
    ]
}

Conclusion

How easy was that huh? Less ten steps to get the job done is pretty good in my book. Once you get used to changing the bucket to public, you will do it automatically, without even thinking about it. Maybe you come back from time to time to this page, to copy the JSON, but that’s about it.

See also  Basic setup of a nodeJS project

Anyways, as always hope you found it useful and see you in the next one. Stay safe!

Related Posts

2 thoughts on “How to make AWS S3 bucket files public

  1. you are really a good webmaster. The site loading speed is amazing. It seems that you’re doing any unique trick. Also, The contents are masterpiece. you have done a wonderful job on this topic!

Leave a Reply

Your email address will not be published. Required fields are marked *