Jump to content

Amazon S3 URL: bucket name as subdomain, not as folder name


sobrenome

Recommended Posts

The Amazon S3 bucket accepts two types of URL formats to deliver the stored files:

1) bucket name as subdomain:

BUCKET-NAME.s3.sa-east-1.amazonaws.com/example/example.png

2) bucket name as a folder:

s3.sa-east-1.amazonaws.com/BUCKET-NAME/example/example.png

IPS chose the last approach, which does not allow the use of a CNAME in Cloudflare to put it in front of Amazon S3, or even a CNAME without Cloudflare to hide Amazon URL.

I would really appreciate if IPS could change the URL generated to Amazon S3 storage to be the first option (bucket name as subdomain), or ate least to give us the option to choose between them. 

Using Cloudflare in front Amazon can help us save a lot of money. And in some countries, Cloudflare has many more POPs than Amazon.

If anyone has any other solution, I appreciate.

Here follows the Cloudflare tutorial to put it on front of Amazon S3:

======

 

I actually just set this up - you don’t need to enable “static hosting” on a S3 bucket as long as the bucket name is the same as the FQDN;

So if you want wow.example.com as the custom domain:

  1. create a bucket named exactly  wow.example.com

  2. go to Cloudflare -> DNS tab and create a CNAME. Name is wow and target is wow.example.com.s3.us-east-1.amazonaws.com

Note: replace us-east-1 with the region where you created your S3 bucket.

 

 

Now I would recommend creating a page rule that matches wow.example com/* so that you can set “cache level” to “cache everything” (also set “SSL” to “Full”)

======

https://community.cloudflare.com/t/is-it-possible-to-use-cloudflare-aws-s3-without-setting-up-s3-static-hosting/52711/13

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...