问题
I'm totally new to Amazon and all of its services. I have set up Amazon S3 and created a CloudFront distribution but what I want is to give a custom domain name to this CloudFront distribution.
I have created a sub-domain on my server and changed the CNAME
to the CloudFront distribution link but I can not access to my content on S3. Can anyone tell me full go through how I can set up with alternate domain names?
回答1:
To give a custom domain name to an Amazon CloudFront distribution:
- Provide an Alternate Domain Name when creating your CloudFront distribution
- Create a
CNAME
record in Route 53 (or your own DNS provider) that points to the URL of your CloudFront distribution (egd3i29vunzqzxrt.cloudfront.net
), or create anA
record in Route 53 that usesAlias = Yes
and select the CloudFront distribution.
From the help tip in the CloudFront console:
If you want to use your own domain name (for example, www.example.com) instead of the CloudFront domain name (for example, d1234.cloudfront.net) for the URLs for your files, specify up to 100 CNAMEs. Separate CNAMEs with commas or put each on a new line. You also need to create a CNAME record with your DNS service to route queries for www.example.com to d1234.cloudfront.net.
回答2:
I think the guide is designed to have you spend more than you should. Instead, you should:
1 Add Alternate Domain Name as the guide says 2 Create "A" record in Route 53, not CNAME. AWS will charge you for each CNAME request.
来源:https://stackoverflow.com/questions/32549785/amazon-cloudfront-alternate-domain-names