AWS Cloudfront is a global Content Delivery Network (CDN) that is easily integrated with Magento to deliver static media to client browsers faster and more efficiently than your webserver can via global network of edge endpoints, which the AWS Cloudfront cache uses to deliver your static content to the end user from both a local edge location and where possible from local cache to avoid multiple hits on your source.
AWS Cloudfront also has the added advantage of spreading the delivery of your content across multiple domains, either sub domains of your own domain name or 123xxxxxxx.cloudfront.com as delivered natively from Cloudfront itself. It is also possible to deliver content via SSL on both native and custom domains with FREE SSL keys issued by Amazon AWS that will cover your content for delivery to all SNI (Server Name Indication) compliant client browsers, a list of SNI compliant browsers can be found here.
Configuring AWS Cloudfront to deliver static Magento assests.
There are a number of areas of Magento which are natural choices for content caching and delivery via Cloudfront
- /media – Images & other static media.
An additional benefit of delivering this content via a number of Cloudfront instances is parallelisation of downloads by the client browser because they will each use a separate domain name.
Using custom domain names on Amazon Cloudfront instances.
Using a custom domain name with your Amazon Cloudfront Instances is simple, and can either be set when you first create the instance, or added / changed at any time after.
First you need to add the CNAME entry to the Cloudfront Instance, within the AWS Management Console.
Next you need to set a CNAME for the domain name you are going to use in your DNS and route it to the Cloudfront domain name for the instance you want it to apply to.
Get FREE SSL from Amazon AWS on Amazon Cloudfront.
Providing you are happy to restrict you client browsers to those that are SNI (Server Name Indication) compliant then you can register for a free SSL certificate to cover your custom domain name Cloudfront instances via the Amazon AWS Certificate Manager. If you opt to use the default Amazon domain names for the instances then SSL is provided automatically and there is no need to register an additional certificate.