Amazon S3 and Amazon Cloudfront are different things, so it’s not a question of one or the other. It can be both.
You can think of Amazon S3 as an extension of the hard drive on your computer. It’s storage, but on the internet.
It gives you a place to keep files that technically, should be safe. So even if you lose your computer or suffer a hard disk crash, your files on Amazon S3 will be there.
Amazon S3 is low-cost so unless you are a heavy user, it won’t cost you more than a few dollars per month.
If you are a relatively light user it will be only one or two dollars per month. But don’t let its low cost fool you – Amazon S3 has 99.99% availability.
You can choose between three types of S3 storage, however the standard option is what you need for use with CloudFront.
If Amazon S3’s selling point is storage – safe storage – then Cloudfront’s main selling point is speed of access. Cloudfront is a CDN – a content delivery network designed to make your content appear quickly on other people’s browsers.
With Cloudfront plus an Amazon S3 bucket, the file when it is accessed will be pulled through to the nearest Cloudfront edge server. where it will remain until the cache control timeout, for the next person to access it.
Edge servers are located all over the world, but are understandably concentrated in areas of high population and internet usage.
More edge servers are sometimes added so can expect the list to grow. At the time of writing, none are located on the African continent, the Middle East and only two are in South America.
The Process For Setting Up Amazon Cloudfront
- Go to Amazon S3 and create an Amazon bucket called images.yourdomain.com
- Go into CloudFront and create a web, (non-streaming) distribution. It will give you the location of the Web distribution something like s1611tr3tql9yr.cloudfront.net.
- Attach the Web Distribution location to your Amazon S3 bucket, images.yourdomain.com
- In your DNS set up a CNAME record to point images.yourdomain.com at your cloudfront Web Distribution location
- Place images into your Amazon S3 bucket using a tool like CloudBerry Explorer
- On your website when you refer to an image use the URL, images.yourdomain.com/name-of-image.jpg