Last updated: Jul 25, 2022
Reading time·3 min
To get an S3 bucket's URL:
Properties
tabStatic Website hosting
sectionhttp://your-bucket.s3-website-us-east-1.amazonaws.com
To get the URL of an S3 Object via the AWS Console:
Copy URL
buttonTo get the URL of an S3 Object based on the bucket's URL:
For example, the URL of an index.html
file located at the root of the bucket
would look similar to the following:
http://your-bucket.s3-website-us-east-1.amazonaws.com/index.html
To get the URL of a file located in the /images
"directory", e.g. with a path
/images/house.png
you would have to append the whole path to the bucket URL -
http://your-bucket.s3-website-us-east-1.amazonaws.com/images/house.png
.
If you get the "403 Forbidden Error" when trying to access an S3 Bucket's endpoint, you have to grant public read access to your S3 bucket.
To grant public read access to your S3 bucket:
Permissions
tabBlock public access (bucket settings)
section, click on the Edit
button, uncheck the checkboxes and Save the changesPermissions
tab, navigate to the Bucket policy
section and click
on the Edit
button. In the textarea paste the following bucket policy to
grant public read access to 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/*" } ] }
Once you save the bucket policy, your bucket will have public read access enabled and the "403 Forbidden" error will be resolved.
Your bucket will be marked as publicly accessible, but the bucket policy only
enables S3 read
access.