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)
EDIT:- So I get rid of zappa created custom domain and created new cloudfront distribution manually as follows:-
Delivery Method - Web Domain name - d35ihv8a5022fe.cloudfront.net origin - randomly-generated-link.aws.amazon.com/production cNAMES - example.com Status - Deployed State - Enabled
I did this because zappa generated cloudfront distribution is hidden in AWS console. However, I noticed Zappa generated distribution endpoint gives forbidden when I check the address in browser and the newly created distribution endpoint redirects to my application.
Still, going to example.com gives me 403 error.