Introduction
When you use AWS S3 for the first time, you may encounter access deny issues.
This issue occurs when you open the object URL in the browser.
The two most likely causes of this problem are the following.
- Amazon S3 Block Public Access is disabled
- The bucket policy denies public visit
Here is how to solve this problem.
Solve problem
1. Unchecking "block all public access"
(a). Goto permissions tab in your bucket and click edit in the block public access section
(b). Make sure "block all public access" is off
2. Apply a new bucket policy to your bucket
(a). Click edit in the bucket policy section
(b). Add the following bucket policy to your bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "{Bucket-ARN}/*",
}
]
}
(Remember to change {Bucket-ARN}
to your own.)
Success
After these two steps, you may notice an additional “Publicly accessible” icon under your bucket.
When we open the object URL in the browser, we will see that it is now accessible properly.
Top comments (0)