I have been checking things up & down on Google & AWS Documentation but can't seem to nail this one.
I have an EC2 instance setup with a domain being served via a virtual host and I need to use a CDN for the contents on the site, mainly images ie website assets.
EC2 Details of the instance
- Virtual Host Set Up
- DNS: Route 53
- No ELB
Cloudfront Distribution Details
- Origin: example.com
- Delivery Method: Web
What I tried to do is use the domain name in the origin and the Cloudfront domain was now redirecting to the origin domain name along with fetching assets by https.
I haven't found any impact on the site speed, pinged from different geo locations thus I have come to doubt whether this was done correctly.
The part which I need to resolve is which of the below path is correct for setting up Cloudfront with EC2:
- Use EC2 instance DNS for 'Origin Domain Name' and add the directory name in the 'Origin Path' for the virtual host
- Only add the domain name in the 'Origin Domain Name'
Thanks for the help!
Attaching Route 53 Details
- A Record => Name: www.example.com, Value: IP ADDRESS & Routing Policy: Simple
- A Record => Name: example.com, Alias: Yes & Alias Target: www.example.com
Updated AWS Setup AWS Setup between EC2, Route 53 & CloudFront