Reputation: 337
I am currently using Amazon Route 53 for my DNS setup and a custom origin (web server outside of Amazon). I'd like to add CloudFront to the mix but I'm not too sure how to set it up?
I've seen Amazon's guide on setting up S3 with Route 53 and CloudFront, but I can't seem to locate any information on doing all this with a custom origin.
Should I be setting it up to work as follows?
I originally planned to host my content on S3 but decided against it because I'd like more control over the hosting (for example, having the ability to use an .htaccess file and ban hacker IPs, etc).
Thanks.
Upvotes: 6
Views: 9595
Reputation: 337
OK so this is how I managed to solve it in the end:
Origin Server:
origin.domain.com
origin.domain.com
shares the same document root as domain.com
domain.com
to www.domain.com
:Amazon CloudFront:
The "Alternate Domain Names (CNAMEs)" is set to www.domain.com
The origin is set to origin.domain.com
Amazon Route 53
The A record for domain.com
is set to my origin server's IP address
The A record for www.domain.com
is set to an alias for the CloudFront distribution
origin.domain.com
is a CNAME for domain.com
Thanks to Matt Houser and Bruce P for their help, by the way. :)
Upvotes: 9
Reputation: 36103
Assuming your have your origin at origin.domain.com
, create your CloudFront distribution, using http://origin.domain.com as the origin.
Create your www.domain.com
DNS entry in Route 53, making it an "Alias" for the CloudFront distribution.
One possible alternative to .htaccess is to use WAF on your CloudFront distribution. This way, you can permit/deny based on IP address.
Upvotes: 3