Making AWS S3 Files Publicly Accessible
I stored some images in S3 but couldn't use them; if I tried to follow the link, I would get 'permission denied' errors.
AWS documentation is a nightmare, so I'm putting the answer here, so I can find it again.
S3 contents are stored in 'buckets'. Each bucket has a unique name. The name of the file in an S3 bucket is called (for some unfathomable reason) the 'key'. The URL for any file in S3 is:
Like I said, though, the file has to have permissions set so it can be viewed publicly.
1. Navigate to S3: https://s3.console.aws.amazon.com/s3/home
2. Either create a new bucket or select an existing bucket (there's a list on the page).
3. Click on the 'Permissions' tab and scroll down to 'Bucket Policy'
4. Click edit and insert the following JSON code and save it (the save button is way at the bottom right, in orange):
Note that you need to insert your own bucket name in the code (indicated in red). Test your URL after; it should work.