Last updated: Feb 26, 2024
Reading time·2 min

To allow public read access to an S3 bucket:
Permissions tab.Block public access (bucket settings) section, click on the Edit
button, uncheck the checkboxes and click on Save changes.
Permissions tab, scroll down to the Bucket policy section and
click on the Edit button. Paste the following policy into the textarea to
grant public read access to all files in your S3 bucket.YOUR_BUCKET_NAME placeholder with your bucket's name.{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject" ], "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*" } ] }
For example, the bucket policy of an
S3 bucket with the name my-bucket will look
as follows.

Save the changes you've made to the bucket's policy and your bucket will have public read access enabled.
(Optional) - If you need to access your bucket with HTTP requests from the browser, you have to update the bucket's Cross-origin resource sharing (CORS) options to allow your frontend's requests.
In the Permissions tab of your S3 bucket, scroll down to the
Cross-origin resource sharing (CORS) section and click on the Edit
button
Paste the following JSON into the textarea and save the changes
[ { "AllowedHeaders": [ "Authorization", "Content-Length" ], "AllowedMethods": [ "GET" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
To test that your bucket has public read access enabled:
Objects tab in your S3 bucket.Copy URL button at the top and copy the public URL of the
file.
Note that you'll see a red badge with the text Publicly accessible next to
your bucket's name.

In this case, the bucket policy only grants public read access to the bucket, so other people can't add objects to your S3 bucket.
You can learn more about the related topics by checking out the following tutorials: