Howto: Deploy to Amazon S3 with Gulp

I just moved one of my sites from GithHub pages to Amazon S3.

This commit should give you some hints if you want to set up similar with Gulp:

https://github.com/bjornerik/bepsays.com/commit/0ca23678730a63a8535080506469264fd4474db9

There are later updates in this file to add support for setting cache headers on static content (css, js …).

The key here is the task aws-publish.

Of obvious reasons I haven’t published my AWS config file with my secret keys, but there are one vital setting there to avoid a dreaded 301 error on deploy:

{
"key": "MY_KEY",
"secret": "MY_SECRET",
"bucket": "bepsays.com",
"region": "eu-west-1"
}

The bucket name must be the same as the virtual host, but with the “dot” in the bucket name you will need to add the region to avoid failure (no idea why).