Backblaze B2 client for Mac, Windows and Linux. B2 is Backblaze’s bulk storage service. It is different than their primary backup business in that it is more like Backblaze B2 in that it is an API-driven cloud storage service. It is about 1/4 the cost of Amazon S3, but has a different API making the range of desktop clients much more limited. Download Authorization with Backblaze B2. I used singed URLs before on AWS S3 so the same should work for Backblaze B2. Head over to the “App Keys” section in the Backblaze web interface and add a new application key. Write down the newly generated ‘keyID’ and ‘applicationKey’. Add a private bucket while you are at it, and upload a.
S3
If you’ve been around the ol’ static website hosting block a few times, you’veprobably come across the possibility of hosting your site out of Amazon S3 andmaybe sticking Cloudfront in front of it for good measure. That stack lookslike the image below, assuming we use Amazon for everything.
Buckets
The big three cloud providers all have their bucket solutions, which is to saythey all provide a way to store files without havingto worry about hard drives. Amazon’s bucket service is called “S3” (short forSimple Storage Service), Google’s is called “Cloud Storage”, and Microsoft’sis called “Blob Storage”.
B2
In recent years a new challenger has appeared, acompany called Backblaze has begun offering a service called “B2” that is wildlycheaper than the competition. I’m always rooting for the underdog, so let’stake a look at hosting a static website from B2.
Using B2 to Host a Site?
B2 does allow you to set a bucket to “public”, and then provides a url whereanyone can download the files. That’s a good start, but there are three problemsthat stand between us and an awesome static website.
- 1: The url B2 provides isn’t exactly something that would make for a catchywebsite name.
- 2: Files served out of B2 don’t have the right content-type headers present.For example, if I type in the path to an index.html file hosted on B2, itprompts me to download the html as a file, rather than rendering it as awebpage.
- 3: There are some nice things that webservers tend to automatically do, likeserving an index.html file if the user requests a base path like “/”
Luckily we can solve all three issues using a cdn service called Cloudflare.With that addition, our B2 static hosting stack looks like this:
Cloud Workers
Cloudflare has a bunch of different services, but there’s really only one weneed for this project: Cloud Workers. Cloud Workers let you write littlescripts that get called when a user requests a url. We’ll be looking at theurl that the user requested, loading the specified file from B2, adding inthe right content-type headers, and then serving the file back to the user.Here’s the script I put together for the cloud worker:
I’ll admit, writing a somewhat complex script was not what I had in mind when starting on the project. Sometimes the internet is just a crazy place.
Performance
Here are some completely un-scientific and un-trustworthy download speed resultsfor loading a 53kb javascript file:
- B2 Stack (Cache miss): 700ms
- B2 Stack (Cache hit): 239ms
- S3 Stack (Cache miss): 498ms
- S3 Stack (Cache hit): 230ms
In case you’re wondering, “Cache miss” means that the file was not found at theCDN layer. That’s Cloudfront for the S3 stack or Cloudflare for the B2 stack.Since the file is not found in the CDN, the CDN will load the file from theorigin and then serve it, usually with some kind of header indicating a“cache miss”. If the CDN has the fileit can provide it right away, resulting in a faster “cache hit”.
Cost
B2 is considerably cheaper than S3, but it’s kind of like saying 0.00001 dollarsis ten times cheaper than 0.0001 dollars. Fl for mac beta. Storage is so cheap that you probably won’t care,unless you’re hosting large video files or something that will take up hundredsof gigs of storage.
Conclusion
As much as I would like to pull for the underdog, the S3 stack is considerablyeasier to set up and use. 3d maker for mac. S3’s UI is nicer to use. S3 can serve your filesdirectly without needing to write a script that runs on every request.The B2 stack is cheaper, but for small to medium sites the difference will benegligible.
Backblaze B2 Price
With WinSCP you can easily upload and manage files on your Backblaze B2 storage/bucket using S3 protocol.
Before starting you should have WinSCP installed.
Collect information about your B2 bucket and API keys in your Backblaze account:
Backblaze B2 Static Website Login
- Endpoint: Locate your bucket on your bucket list and find a hostname labeled Endpoint. It has a format like
s3.region.backblazeb2.com
. - If you do not have an Application key yet (not Master application key), go to App Keys page and generate new application key. Note both keyID and applicationKey.
Backblaze B2 Static Website Builder
Start WinSCP. Login dialog will appear. On the dialog:
- Make sure New site node is selected.
- On the New site node, select Amazon S3 protocol.
- Enter your bucket endpoint to the Host name box.
- Enter your keyID to into the Access key ID box and your applicationKey to Secret access key box.
- Save your site settings using the Save button.
- Login using the Login button.
Backblaze B2 Static Website Design
- Guide to uploading files;
- Guide to automating operations (including upload);
- Official Backblaze guide for connecting using WinSCP.