How to serve multiple S3 buckets via single AWS CloudFront distribution

Creating AWS CloudFront Web Distribution

  1. Under Origin Domain Name select website bucket.
  2. Leave Origin Path blank.
  3. Origin ID has been pre-populated.
  4. Select Yes for Restrict Bucket Access.
  5. Click on Create New Identity for Origin Access Identity.
  6. You can stick to the default value for Comment.
  7. Select Yes under Grant Read Permissions on Bucket.
  8. You can leave Origin Custom Headers blank.
  1. I am going to select Redirect HTTP to HTTPS for Viewer Protocol Policy.
  2. I will stick to the default value for all other parameters under this section.
  1. Provide index.html under Default Root Object so that CloudFront will load index.html page by default whenever you will hit the URL.
  2. You can leave all other settings default.
  3. Click Create Distribution button.
  1. Under Origin Domain Name select blog bucket.
  2. Leave Origin Path blank.
  3. Origin ID has been pre-populated.
  4. Select Yes for Restrict Bucket Access.
  5. Click on Create New Identity for Origin Access Identity.
  6. You can stick to the default value for Comment.
  7. Select Yes under Grant Read Permissions on Bucket.
  8. You can leave Origin Custom Headers blank.
  9. Click on Create button.
  1. Write blog/* under Path Pattern.
  2. Select blog bucket for Origin.
  3. I am going to select Redirect HTTP to HTTPS for Viewer Protocol Policy.
  4. I will stick to the default value for all other parameters.
  5. Click on Create button.

Vlog:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store