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:
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.
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
The result as below
Top comments (8)
Hi Cao,
I received the message below after i updated the region to us-east-1 and reloaded the page. Any ideas?
Hi Osinachi-Uro,
Could you give me message or photo about your issue ?
It returns a page that says:
ERROR
Failed to contact the origin
It worked now!
It took a while but it's working fine now.
Thanks
hey, im still unable to access the bucket objects even after specifying the region. Where did i go wrong?
Could you share buck policy and config CloudFront for me ?
hey Cao, i fixed it. Thanks though!
Thanks! It works for me! The origin domain, is the same generated when you create the static website hosting. In my case was: my-folder-name.s3-website-us-west-2.amazonaws.com