DEV Community

loading...

How to resolve issue Access Denied between S3 and CloudFront

khanhcd92 profile image Cao Duy Khanh ・1 min read

I have setup S3 to store image files and access them through CloudFront. But I have an error Access Denied and link CloudFront was redirect to S3 link as below image:
Alt Text


The root cause of issue relates to “Requests made with the legacy global endpoint go to US East (N. Virginia) by default.”

Refer: https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html


To fix this issue, we need to back to setup CloudFront before.
Alt Text
Normally, we will select own s3 bucket which contains static files on dropdown list. In this case, endpoint is format as:<bucket>.s3.amazonaws.com
This endpoint is global endpoint. We need to change to region endpoint then issue will be fixed. The region endpoint format as: <bucket>.s3-<region>.amazonaws.com
Alt Text
The result as below
Alt Text

Discussion (0)

pic
Editor guide