question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Amplify Publish - CloudFront 307 redirection and Access Denied after deployment in non-US region

See original GitHub issue

Describe the bug

After amplify add hosting and amplify publish deployment where resources are created in a non-US region, CloudFront redirects (307) to S3 which returns AccessDenied. This is most likely because CloudFront is configured with Origin Access Identity so the S3 bucket cannot be accessed directly. I suspect it might be related to: https://aws.amazon.com/premiumsupport/knowledge-center/s3-http-307-response/ and the bucket on CloudFront doesn’t have the region in the URL.

> amplify version
0.2.1-multienv.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
realityfiltercommented, May 21, 2020

This error breaks all amplify projects with hosting in all regions except us-west-2. Could this ticket be reopened, please. This error is not easy to debug and this ticket saved me a lot more investigation time. Thank!

Using amplify version 4.20.0

2reactions
onhatecommented, Mar 2, 2020

For anyone facing similar issues deploying to us-west-2, you should modify the S3AndCloudFront/template.json section that specifies the origin bucket for CloudFront from

"DomainName": {
  "Fn::GetAtt": [
    "S3Bucket",
    "DomainName"
  ]
}
"DomainName": {
  "Fn::GetAtt": [
    "S3Bucket",
    "RegionalDomainName"
  ]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Amplify publish causes AccessDenied error - Stack Overflow
I suspect this has something to do with the S3 bucket not being in the default us-east-1 region and amplify not setting up...
Read more >
Resolve Access Denied errors from a CloudFront distribution ...
To troubleshoot Access Denied errors, first determine if your distribution's origin domain name is an S3 website endpoint or an S3 REST API ......
Read more >
Troubleshoot HTTP 307 errors in Amazon S3 | AWS re:Post
To avoid the 307 Temporary Redirect response, send requests only to the Regional endpoint in the same Region as your S3 bucket: If...
Read more >
Amplify AWS Access Denied | How To Fix It? - Bobcares
Solution: To resolve this, use amplify configure project to change the distribution directory and then re-run amplify publish .
Read more >
test by alan alan - Issuu
Permissions—Grant or deny access to others who want to upload or download data into ... Amazon S3 returns the following: HTTP/1.1 307 Temporary...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found