Are there use cases that lend themselves better to Amazon cloudfront over s3 or the other way around? I\'m trying to understand the difference between the 2 through examples
CloudFront and S3 Bucket is not the same. In layman's terms: CloudFront enables you to accelerate content delivery of your web contents via Content Delivery Network (CDN) in edge locations, whereas S3 Buckets are where you store your actual files. CloudFront sources may not necessarily be from S3 but for easier visualization of S3 integration with CloudFront:
Another case for using CloudFront over S3 is that you can use an SSL certificate to a custom domain in CloudFront whereas you cannot in S3. A pretty good reason imho!
Amazon CLOUDFRONT and S3 are two different services provided by Amazon Web Services.
Amazon S3 is a storage service in which we can store static files like:
css, images, javascripts,videos, etc...
Amazon CloudFront is a middle-ware which stands in between a user requesting for a file from AWS and the S3 data center in a specific region, CloudFront is used to speeds up distribution of your static and dynamic web content from S3 to the User.
You can understand it better by an example:-
For example, your S3 is located in AWS region US East (N. Virginia) which a data center location to store your files.
If a user from India tries to access a file from a AWS server in Virginia, then user would need to go to that specific location with a request, and this will take a lot of time.
What CloudFront does is that it stands as a middleware between user and AWS S3.
The most often used files can be cached on CloudFront and what it does is, it replicates those files on edge locations (To deliver content to end users with lower latency, Amazon CloudFront uses a global network of edge locations for content delivery).
If the content is already in the edge location with the lowest latency, CloudFront delivers it immediately. If the content is not currently in that edge location, CloudFront retrieves it from an Amazon S3 bucket and provides it to user as faster as it can.
Every request is given a new DNS from CloudFront to the S3, so this would result in lower traffic as well as more parallel request processing.
Following is the list of current edge locations as per July-2016:-
United States
Europe
Amsterdam, Netherlands (2)
Dublin, Ireland
Frankfurt, Germany (3)
London, England (3)
Madrid, Spain
Marseille, France
Milan, Italy
Paris, France (2)
Stockholm, Sweden
Warsaw, Poland
Asia
Chennai, India
Hong Kong (2)
Mumbai, India
Manila, the Philippines
New Delhi, India
Osaka, Japan
Seoul, Korea (3)
Singapore (2)
Taipei, Taiwan
Tokyo, Japan (2)
Australia
Melbourne, Australia
Sydney, Australia
South America
São Paulo, Brazil
Rio de Janeiro, Brazil
From this you can conclude that if the users are limited are from the same region as your S3 is hosted on, then you do not require to go for CloudFront, and if the number of users is increased on global level then you should definitely use CloudFront for better latency and traffic control.
Amazon S3 is a great object storage platform if you are looking for a globally distributed storage system to protect against regions/zones going down. It is also great for static/fixed content that is not transactional and changing such as pictures, videos, images, backups, etc. Hope that helps!