- Newest
- Most votes
- Most comments
I think what you are missing is the bucket policy (Something like below)
`{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::Bucket-Name/*"
]
}
]
}`
To obtain a public access link for your S3 bucket resource and resolve the access denied error, you'll need to follow these steps:
-
Disable Block Public Access settings for your bucket:
- Go to your S3 bucket in the AWS Management Console
- Click on the "Permissions" tab
- Scroll down to "Block public access (bucket settings)"
- Click "Edit" and uncheck all four options
- Save changes
-
Update your bucket policy to allow public read access:
- In the same "Permissions" tab, scroll to "Bucket policy"
- Click "Edit" and add a policy that grants public read access to your objects
-
Ensure the object itself allows public read access:
- Go to the "Objects" tab in your bucket
- Select your index.html file
- Click "Actions" and choose "Make public using ACL"
-
Double-check your bucket is configured for static website hosting:
- Go to the "Properties" tab of your bucket
- Scroll down to "Static website hosting"
- Ensure it's enabled and properly configured with your index document
After completing these steps, you should be able to access your index.html file using the S3 website endpoint URL provided in the "Static website hosting" section.
Please note that making your S3 bucket public comes with security implications. Only do this if you intend for the content to be publicly accessible. For more secure options, consider using Amazon CloudFront with your S3 bucket or implementing more granular access controls.
Remember, by default, new S3 buckets and objects are set to block public access for security reasons. You're explicitly overriding these safeguards, so make sure this aligns with your intended use case.
Sources
Use your domain for a static website in an Amazon S3 bucket - Amazon Route 53
Amazon S3 Block Public Access - AWS
Access control in Amazon S3 - Amazon Simple Storage Service
Relevant content
- asked 6 months ago
- asked 2 years ago

Or Set the Everyone ACL to be READ on objects