4

I run a Django project deployed on AWS lambda using serverless Zappa framework. This can be accessed by a randomly generated link from AWS API Gateway lets say:-

randomly-generated-link.aws.amazon.com/production

I have also created an SSL certificate from ACM and verified it with my domain lets say

example.com

Now when i run zappa certify, this command certifies my domain successfully and creates a custom domain under API gateway console with the following configurations:-

Endpoint Configuration Edge optimized

Target Domain Name d25ihv8a5022zi.cloudfront.net

Hosted Zone ID A2FDTNGATAQYW6

ACM Certificate example.com (c504428e)

Now, I need to point my domain name example.com to randomly-generated-link.aws.amazon.com/production, so I updated my records on Godaddy with CNAME as follows:-

TYPE - CNAME NAME - example.com VALUE - d25ihv8a5022zi.cloudfront.net TTL - 1 HOUR

EXPECTED RESULT - My application thats running on randomly-generated-link.aws.amazon.com show be accessable from example.com.

WHAT I GET - 403 ERROR The request could not be satisfied. Bad request. Generated by cloudfront (CloudFront)

Abishek
  • 141
  • 1
  • 2
  • 1
    Are you using `https://...` when accessing the API you created? API Gateway does not support unencrypted HTTP and on an Edge Optimized deplohment, you'll get an error from CloudFront if you try without. – Michael - sqlbot May 09 '19 at 01:06
  • I am able to access my application on https://randomly-generated-link.aws.amazon.com/production but the error comes when I visit example.com – Abishek May 09 '19 at 14:33
  • @abi-crazieeee Did you fix the issue? – Krishna Mohan Sep 14 '19 at 05:57
  • @Krishna Mohan Yes, Create a hosted zone on your AWS Route53 for your domain. Set route53_enabled to True in your zappa_settings.json and then recertify. It may take upto 40 minutes for the dns to propagate. – Abishek Sep 15 '19 at 06:34

1 Answers1

2

Did you set the Alternate Domain Name for the CloudFront distribution to example.com?


Alternate Domain Name


Hope that helps :)

MLu
  • 23,798
  • 5
  • 54
  • 81