Most simple web applications are built as three-tier architectures. You might not even be aware of this, as it is (most of the time) unintentional. The three tiers of these applications are:
Data (usually kept in a relational database)
Logic (dynamic content generated in a web or application server)
Presentation (static content provided by a web server)
Over time, web development frameworks slowly lost the distinction between the logic and presentation levels. Frameworks like PHP, Ruby on Rails, and Django rely on Apache modules, effectively merging the logic and presentation levels. Only when performance is an issue will these two layers be untangled, mainly because the overhead of Apache is not necessary to serve semistatic content.
But there is another alternative: CloudFront. Amazon CloudFront is a content distribution network, designed to bring static content as close to the end user as possible. It has edge locations all over the world, storing your files and delivering them upon request. Perhaps we don’t need the edge locations yet, but we can use CloudFront for its scalability and to offload our application server. We’ll use CloudFront as the presentation tier in our three-tiered architecture.
Amazon S3 is a regional service, just like EC2 and RDS, while CloudFront is a global service. S3 works with buckets, and CloudFront works with distributions. One CloudFront distribution exposes the content of one S3 bucket (one bucket can be exposed ...