Moving static sites from AWS to Bunny net

I have a handful of static websites which have been living on AWS. They're there because they are too big for GitHub Pages. 

But AWS is a slog for this, and I was looking around for alternatives. My criteria: it must be easy. 

I was pointed towards bunny.net which is working well. As an increasingly important bonus, they are based in Europe.

For static sites it goes like this:

  1. You set up a "storage zone", put files into it, and it prompts you to connect a "pull zone". 
  2. The pull zone is where you get to add a custom domain. I don't think it even asks about "Let's Encrypt", and just gets on with it for you.

The only part I found tricky was how to sync several gigs of files to the storage zone.  I tried rclone: it works, but bunny-transfer sync is faster (it uses the Bunny Net's APIs rather than S/FTP).

So that's where Skitters now lives.

* * *

There is a UI to purge the cache. I prefer to script those things, and the magic is:

curl -X POST -H "AccessKey: $BUNNY_ACCESS_KEY" \
"https://api.bunny.net/pullzone/${PULLZONE_ID}/purgeCache"

You can get the a PULLZONE_ID by querying for all the pull zones you own:

curl -H "AccessKey: $BUNNY_ACCESS_KEY" \
"https://api.bunny.net/pullzone"

The access key is under Account settings > API Key.

* * *

For my reference, here's the rclone configuration I was using:

$ cat ~/.config/rclone/rclone.conf
[s3]
type = s3
provider = AWS
access_key_id = ???
secret_access_key = ???
region = eu-west-1

[skitters_bunny]
type = sftp
host = uk.storage.bunnycdn.com
user = dog0001
pass = ???
shell_type = unix

The bunny pass comes via a command like: rclone obscure R/W-key-here — the key is on the storage zone page under the FTP and API Access tab at https://dash.bunny.net.

Then:

rclone copy s3:bucket_name_here skitters_bunny: --progress --inplace

Or:

rclone sync . skitters_bunny:  \
--progress --inplace --metadata --max-connections 8 \
--exclude ".git/**"

* * *

The configuration for bunny-transfer:

export BUNNY_ACCESS_KEY="????"
bunny-transfer sync . name-of-bunny-storage-zone