Most awaited post we wanted to present in Sitecore Community. Major objective of this article not to compare Azure CDN with Amazon CloudFront CDN but we thought out of box and questioned ourselves that can we utilize Amazon CloudFront to serve sitecore media?
We all know Amazon CloudFront provides to choose origin at the time of implementation. Most recommended way is to implement CloudFront with S3 (Simple Storage Service) as origin. For this we have product already available on Sitecore Marketplace known as CloudConnect.
The other ways to use CloudFront are with custom or EC2 based origins. This article explains step by step process to implement with custom or EC2 based origins for Amazon CloudFront. There are two parts of implementation
Choose Create Distribution
On the first page of the Create Distribution Wizard, in the Web section, choose Get Started
You can use an alternate domain name, instead of the name assigned to you by CloudFront; by following the steps in Using Custom URLs for Files by Adding Alternate Domain Names (CNAMEs).
Add Settings in configuration to set Media Server URL to the Amazon CloudFront endpoint from earlier step.
AlwasIncludeServerUrl property will cause the Media Link Provider to include the above URL in the media links that are rendered. This is only required to be true on CD servers, set this as false on CM so that those assets on that server are rendered from the database as normal.
Set Cacheability headers to public, so that the CDN will start caching our media.
Custom code for Clearing CDN cache can be written so that user don’t have to go to Amazon Console again and again to clear/invalidating cache.
While using CloudFront CDN with any origin – CloudFront provides APIs and using those APIs, Sitecore commands can be configured.
Hope this article helps in clarify the process which we have followed while implementing this feature. If there are any suggestions or feedback please write back at email@example.com
For this article – Technical Implementation done by Mitesh Patel(Sitecore Certified Developer) and Business Analysis, Documentation done by Kuntesh Bhatt.
Let us have coffee together and discuss your requirement for Sitecore. Mail us at firstname.lastname@example.org.