S3 could be a highly available and reliable hosting for files, but it's tied to the region where it's hosted. For example, a user from Australia will face latency issues when accessing and downloading files from S3 bucket hosted in the America regions due to the physical distance.

To alleviate the issue, S3 buckets could be served via CloudFront as a content delivery network where Australia users, as in the example, could access cached copies of the files initially hosted in America from an Australia server.

Steps to create CloudFront distribution from AWS S3 bucket:

  1. Create a private S3 bucket if you don't already have one.
  2. Go to the CloudFront dashboard in the AWS Console.
  3. Click on the Create Distribution button.
  4. Click on the Origin domain search box.
  5. Select your S3 bucket from the list.
  6. Change the name of the Origin if necessary.
  7. Select Yes use OAI for S3 bucket access.
  8. Click on the Create new OAI button.
  9. Change the name for Origin access identity if necessary.
  10. Click on the Create button.
  11. Select Yes, update the bucket policy.
  12. Accept defaults or continue configuring CloudFront distribution options.
  13. Click on the Create distribution button.
  14. Wait for the distribution to finish deploying and access the S3 bucket using CloudFront's distribution domain name.
Discuss the article:

Comment anonymously. Login not required.