AWS Lambda, AWS API Gateway, AWS Cloudfront gives 403 error

amazon-api-gatewayamazon-cloudfrontamazon-lambdaamazon-web-servicesgodaddy

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)

Best Answer

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


Alternate Domain Name


Hope that helps :)