Can you guys help me out in identifying what I am doing wrong in setting up the cloudfront for my ec2 instance (web server) for a custom domain of mine.
I am using my domain name (www.example.com) as the origin domain name.
I have also supplied a certificate to the cloudfront (*.example.com) using ACM.
The problem I am facing is, when i point out my custom domain name to the cloud fronts domain name in route53 using an alias record.
My website responds with an error 502. I’ll really appreciate any help. I have explored all the content provided by AWS in respect to this but nothing seems to work till now.
As Tom says, there can be multiple things at play here. One might even be not giving CloudFront enough time to deploy…this can sometimes take 30 minutes or more. The troubleshooting tips Tom provides above would be a good first start.
If you are using EC2 as origin, you cannot use certificate provided by AWS Certificate Manager (ACM), you must use a certificate that is signed by a trusted third-party certificate authority (CA)
Please check this link