3 ms·
I Setup My Own Personal CDN Using Cloudflare and S3
- NovemberWhiskey 6y agoArticle reads more like "I became a user of Cloudflare's CDN" than "I setup my own personal CDN"; perhaps I'm missing the point though?!
- cameronfraser 6y agoI think the default image for the youtube video in the article speaks to who the target demographic is.... it's definitely not HN, but w/e
- jayzalowitz 6y agoYou should really be using an OAI to let cloudfront get your content, serve out of there with a local cache policy.. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html https://docs.aws.amazon.com/AmazonCloudFront/latest/Develope... Open bucket is an antipattern here.
- whalesalad 6y agotl;dr for anyone ever needing to use S3 as a website: - S3 bucket w/ same name as domain. - CNAME to bucket - OR enable static website hosting, CNAME to your bucket's website dns name provided by AWS. - Done, just make sure CF is proxying not doing pass-thru. - PS, permissions need to allow public read of your data, of course.
- NovemberWhiskey 6y agoOr if you're already in the AWS ecosystem, maybe don't even bother with Cloudflare and just use AWS CloudFront?
- whalesalad 6y agoI can't think of a good reason to not use Cloudflare. They are incredible. (That being said, there is nothing wrong with Cloudfront. On a recent project we are using all three, cloudfront and cloudflare are not mutually exclusive)
- mazamats 6y agoCloudflare acts as a transparent proxy, cloud front lets you cache only s3 buckets...
- mike503 6y agocost
- underbluewaters 6y agoI'm just going to go ahead and threadjack here with a CDN question since the article isn't all that informative. What's the best way to utilize a service like Cloudfront or Cloudflare when you need low latency access to static files that aren't getting a lot of traffic? I'd pay more for a service that lets me serve 12kb-10MB files with <50ms latency on Cloudflare edge nodes but some of them are only going to be accessed once a day or less. My understanding is that most of the time these files would just fall out of the edge cache. There'd still be the advantage of going through Cloudflare/Cloudfront's private network but I'm still going to be limited by S3's latency.
- Hitton 6y agoI don't know about Cloudfront, but for Cloudflare check out Cloudflare Workers Sites.
- TYPE_FASTER 6y agoCloudflare will respect the "Expires" HTTP header: https://support.cloudflare.com/hc/en-us/articles/200172516-Understanding-Cloudflare-s-CDN https://support.cloudflare.com/hc/en-us/articles/200172516-U... It looks like the edge cache max TTL is a month: https://community.cloudflare.com/t/how-long-cloudflare-keeps-cached-files/10282/5 https://community.cloudflare.com/t/how-long-cloudflare-keeps...
- simonw 6y agoIf you want to survive a spike of traffic from something like HN a simple way to do it is to run your site behind something like Cloudflare and set each page to cache for a short period of time. Cloudflare implements a dog pile prevention mechanism where if ten simultaneous requests come in for the same page they will make only a single request to the backend, so even just a few seconds of cache time can absorb a huge amount of traffic. Since my blog rarely updates I use a 15 minute cache time and manually purge the Cloudflare cache when I modify a blog entry. I've survived quite a few high traffic incidents that way.
- velebak 6y agoIf you're using S3, what's wrong with Cloudfront?
- mike503 6y agocharges for traffic from edge -> user. At least with Cloudflare, you'd only be charged the (roughly one) trip from origin (s3) -> edge. Then it's free.
- mazamats 6y agoYou don’t even need the S3 Bucket... Cloudflare will work as a transparent proxy and will cache all static assets.