<img src="https://secure.leadforensics.com/84817.png" style="display:none;">

How to setup an AWS S3 bucket to be accessed through sub domains with Cloudflare DNS.

Website Management & Code | | 1 minute read

The client wanted to create a file server for training documents including MP4, PDF, PPT, WMV, etc. that was accessible through different sub domains. DNS managed through Cloudflare.

In Amazon's S3 dashboard, create a bucket that matches the subdomain you want to use.

2018-08-24_09h04_23

For example, videos.domain.com sub domain would need a matching bucket, videos.domain.com. Make sure the created bucket is set to PUBLIC.

2018-08-24_09h18_40-1

Left click on the bucket to open it. Go to Permissions and CORS configuration.

2018-08-24_09h07_57

Inside CORS configuration, you will need to add this information configured for your subdomain:

<?xml version="1.0" encoding="UTF-8"?>

<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">

<CORSRule>

<AllowedOrigin>http://videos.domain.com</AllowedOrigin>

<AllowedMethod>PUT</AllowedMethod>

<AllowedMethod>POST</AllowedMethod>

<AllowedMethod>DELETE</AllowedMethod>

<MaxAgeSeconds>3000</MaxAgeSeconds>

<ExposeHeader>x-amz-server-side-encryption</ExposeHeader>

<ExposeHeader>x-amz-request-id</ExposeHeader>

<ExposeHeader>x-amz-id-2</ExposeHeader>

<AllowedHeader>*</AllowedHeader>

</CORSRule>

</CORSConfiguration>

Cloudflare Configuration

You will need to create a CNAME record. Set the name as the subdomain, in our example, this is video.

The Value would be: video.domain.com.s3.amazonaws.com

2018-08-24_09h13_12-1

 

Did you find this article helpful?
Subscribe and get our upcoming posts in your inbox
  • Get the Marketing Resources You Need By Leading Sales Initiatives
  • Leveraging User-Generated Content to Drive SaaS Growth. 
  • Should I Outsource My Traffic Reporting/Monitoring

More Than Just Great Websites. Marketing Strategies For Growth.

Call Today 412 942 0222 <>