How to Create a CloudFront Download Distribution with Custom Origin

How to Create a CloudFront Download Distribution with Custom Origin

AWS CloudFront is a content distribution service offered by AWS to speed up the distribution of static content, such as media files, html, js, css, etc. CloudFront serves its content through its ever growing edge locations network. The AWS CloudFront serves its content from the origin server configured during the distribution configuration. For the download distribution, CloudFront supports custom origins similar to a storage device such as an HTTP server. CloudFront supports the AWS services, such as EC2, and ELB as the custom origin. While working with the custom origin, the following is recommended:

  • The clocks of the custom origin is synchronized with AWS
  • Host and serve the same content on all the servers
  • The origin must be available publicly

The CloudFront streaming distribution does not support the custom origin functionality.

The present guide demonstrates how to create a download distribution for the AWS CloudFront using AWS EC2 as the custom origin.

1. Launch a new instance.

2. Configure the web server on the EC2 instance and upload a media file to it. In the given instance, the user has installed the Apache web server. The user has uploaded the aws.jpg file as the media file to the Apache web server.

3. Access the media file using the public DNS of the instance.

4. Go to the AWS CloudFront Console and select create distribution. Select the download distribution.

5. In the origin settings instead of specifying the AWS S3 bucket name, specify the public DNS of the EC2 instance configured in steps#1 & #2. Provide a description for the custom origin in the origin ID.

Provide the values for the origin protocol either as HTTP or as Match Viewer. If the Match Viewer is selected as a protocol policy, CloudFront will connect to the origin using the protocol specified in the request.

6. Configure the other parameters.

7. Once all the parameters are configured, the CloudFront distribution deployment should be “In Progress”.

8. Once the distribution is deployed it will be available for access.

9. The user can access the media file using the distribution instead of using the public DNS of the origin.

Keywords: Amazon Web Services, AWS, Amazon AWS Console, AWS S3, Amazon CloudFront, AWS CloudFront, CloudFront, AWS EC2, AWS S3, Amazon S3, Download Distribution, AWS ELB, AWS IAM, CDN, Content Distribution Network

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations