0
votes

I'm using AWS S3 and Cloudfront to host a website (e.g. www.company.com). I want to additionally have the the naked domain (without the www) to point to the same content. I initially created a redirect in DNS but https://company.com didn't work.

I can create an apex record for the naked domain in the DNS but can I point it to the same cloudfront CNAME used for the www.company.com or do I have to create a new S3 bucket and new cloudfront distribution?

2
Are you using Route53 for DNS or an external service?Ashan
External service.Swordfish

2 Answers

0
votes

S3 to CloudFront Distribution

  1. Create two CloudFront distributions
  2. Request for Certificates from AWS Certificates Manager
  3. Create CNAME with Route 53 and point the alias target to the respective distributions
  4. Create Origin in both distributions pointing to that S3 bucket

Hope it helps.

0
votes

Another solution using only one Cloudfront distribution, if redirecting company.com to www.company.com is acceptable (usually it's preferred).

  1. Create an S3 bucket named company.com
  2. Configure the bucket for static website hosting. Choose "Redirect requests for an object" and enter www.company.com.
  3. Update your DNS a record to point to the bucket.