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?
To give a custom domain name to an Amazon CloudFront distribution:
CNAME
record in Route 53 (or your own DNS provider) that points to the URL of your CloudFront distribution (eg d3i29vunzqzxrt.cloudfront.net
), or create an A
record in Route 53 that uses Alias = 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.
I think the guide is designed to have you spend more than you should. Instead, you should:
Update:
Since this release (Apr 8, 2019) when you add an alternate domain name to a distribution, you must also attach a SSL/TLS certificate to that distribution that covers the alternate domain name.
So, first of all make sure that after you registered the domain name with your domain provider (GoDadday, CloudFlare, Route 53 etc') and created a CNAME
record
you should do the following:
Add an SSL/TLS certificate from an authorized certificate authority (for example - Let's Encrypt) to CloudFront that covers the domain name you plan to use with the distribution - to validate that you are authorized to use the domain. (Read more in here).
And only then update your distribution to add an alternate domain name:
Open Amazon CloudFront console -> General view -> Edit -> Alternate Domain Names (CNAMEs) -> enter the CNAME that you want to associate with the CloudFront distribution (for example www or home).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With