Next: Using WebSockets, Previous: Using Different Origins, Up: Working with Distributions [Index]
“Using Custom URLs for Files by Adding Alternate Domain Names (CNAMEs)”
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html
In CloudFront, an alternate domain name, also known as a CNAME, lets you use your own domain name (for example, ‘www.example.com’) for links to your files instead of using the domain name that CloudFront assigns to your distribution. Both web and RTMP distributions support alternate domain names.
When you create a distribution, CloudFront returns a domain name for the distribution, for example:
d111111abcdef8.cloudfront.net
When you use the CloudFront domain name for your files, the URL for a file called /images/image.jpg is:
http://d111111abcdef8.cloudfront.net/images/image.jpg
If you want to use your own domain name, such as ‘www.example.com’, instead of
the cloudfront.net domain name, you can add an alternate domain name to your
distribution, like ‘www.example.com’. You can then use the following URL to
view /images/image.jpg
:
http://www.example.com/images/image.jpg
The following task list describes how to use the CloudFront console to add an alternate domain name to your distribution so that you can use your own domain name in your links instead of the CloudFront domain name.
For information about updating your distribution using the CloudFront API:
If you want viewers to use HTTPS with your alternate domain name:
Make sure that you do the following before you update your distribution to add an alternate domain name:
Update the following values:
Add your alternate domain names. Separate domain names with commas, or type each domain name on a new line.
Choose the following setting:
Use HTTPS; choose Custom SSL Certificate, and then choose a certificate from the list.
Choose an option:
Older browsers or other clients that don’t support SNI must use another method to access your content.
CloudFront serves your HTTPS content using dedicated IP addresses. If you select this option, you incur additional charges when you associate your SSL/TLS certificate with a distribution that is enabled.
Configure the DNS service for the domain to route traffic for the domain, such
as example.com
, to the CloudFront domain name for your distribution, such as
d111111abcdef8.cloudfront.net
.
Create an alias resource record set. With an alias resource
record set, you don’t pay for Route 53 queries. In addition, you
can create an alias resource record set for the root domain name
(example.com
), which DNS doesn’t allow for =CNAME=s.
For more information, see Routing Queries to an Amazon CloudFront Distribution in the Amazon Route 53 Developer Guide.
Using dig
or a similar tool, confirm that the resource record set that you
created in step 7 points to the domain name for your distribution. For more
information about dig
, go to http://www.kloth.net/services/dig.php.
Next: Using WebSockets, Previous: Using Different Origins, Up: Working with Distributions [Index]