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

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 copy of the files initially hosted in America from an Australia server.

Steps to create CloudFront distribution from AWS S3 bucket:

  1. Create a public S3 bucket.
  2. Create a Web Distribution in AWS CloudFront.
    1. Go to the CloudFront service in AWS console.
    2. Click on the Create Distribution button.
    3. Click the Get Started button in the Web section.
    4. Configure Origin Settings.
      1. Select S3 bucket in Origin Domain Name.
      2. Set Origin ID name.

        A default ID will be created if left blank.

    5. Configure Default Cache Behavior Settings
      1. It's safe to just accept defaults.
    6. Configure Distribution Settings
      1. Accept default settings.
    7. Click the Create Distribution button at the bottom of the page.
    8. Wait until the status column turns to Deployed from the initial In Progress.

      This will take a few minutes.

    9. Try accessing objects in your S3 bucket using the URL in the Domain Name column of your newly create CloudFront distribution.
Share this guide!
Discuss the article:

Comment anonymously. Login not required.

Share!