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
- go to you AWS S3 bucket and click on permissions
- go to section “Block public access (bucket settings)” and click “Edit“
- uncheck “Block all public access“
- go back to AWS S3 bucket permissions
- scroll down to section “Bucket policy” and click “Edit“
- paste the below JSON
- change the “Resource” “<bucket_name>” to the name of your bucket
- click “Save changes“
- 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.
Anyways, as always hope you found it useful and see you in the next one. Stay safe!
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!
Thanks man, appreciate it.🤗 Hope you like the content, more to come in the future 🚀😉