adam121 - Fotolia

Does AWS CloudFront work with static and dynamic content?

Dan Sullivan reviews AWS CloudFront and the two types of content it works with, static and dynamic.

AWS CloudFront works with both static and dynamic content.

CloudFront is Amazon's content delivery network (CDN). As with other CDNs, Amazon has multiple data distribution points around the globe. When a user selects content from your website or application, CloudFront routes the request to the distribution point with the lowest latency. What happens next depends on whether the content to be delivered is static or dynamic.

Static content is served from Amazon Simple Storage Service (S3). Since the content does not change, CloudFront can keep copies of static webpages and serve them directly from S3. Amazon S3 is a global resource, meaning the CloudFront distribution points can retrieve content from the closest S3 point (assuming it has the lowest latency).

Websites have become more dynamic and generate content specific to users. For example, dynamic content might include a mix of products recommended for a particular customer or a set of news stories tailored to one person's interests. Clearly, you do not want to have your application generate all possible dynamic pages and then store them on S3. Pages are better generated on the fly.

When pages are generated dynamically, they cannot be stored in multiple locations. Instead, AWS CloudFront uses a cluster of servers and Elastic Load Balancing, or ELB, at the point of origin. These servers are configured to generate content and scale with demands for dynamic content. The dynamic content is then routed in the most efficient way to the client device through a distribution point. Amazon implements TCP optimizations between the distribution point and the client device. It also optimizes the route between the point of origin of the dynamic content and the distribution point by maintaining persistent connections.

Although static and dynamic content are retrieved from separate resources, both are supported in a single CloudFront supported domain. Amazon charges the same rates for both static and dynamic content.

Dig Deeper on AWS cloud development

App Architecture
Cloud Computing
Software Quality