Serverless Design Patterns and Best Practices
上QQ阅读APP看书,第一时间看更新

CDN with CloudFront

CloudFront is Amazon's CDN service. A CDN's primary focus is to improve the delivery of static assets to the end user. This task is typically accomplished by running multiple points of presence (POPs) around the globe and distributing your contents in those various geographic locations. When a user somewhere on the planet requests one or more of your files, the CDN can fetch the content that is closest to the user to minimize latency. Of course, this is only one small and dumbed-down explanation of a single CDN feature. The bottom line is that CDNs help us to speed up delivery of our content and should be used in any web application.

CloudFront has some very nice features that will allow us to integrate with other AWS services. We will create a CloudFront distribution that will pull our content from S3. In this way, CloudFront is a layer that aids in the acceleration of content delivery but does not own any content itself. We'll be able to configure caching controls to suit our needs and will also be able to serve our content over a custom domain with a free TLS certificate from AWS Certificate Manager. All of this is possible thanks to CloudFront.