Create CloudFront distribution from AWS S3 bucket

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 on America region due to physical distance between the two regions. To alleviate the issue, S3 buckets could be served via CloudFront as content delivery network where Australia users in the example could access the files initially hosted in the US from Australia's server's.

These steps describe how to create a CloudFront distribution from an 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.

Sign up for AWS Certified Solutions Architect - Associate and many other great courses on Udemy to learn more.


Written by Mohd Shakir Zakaria. Last updated on 2019-03-22