Best strategy to deploy static site to s3 on github push? [closed]
I had the same goal some time ago and have now released a little tool, which solves the problem at least for me. It uses AWS Lambda
and deploys a specific branch of the repository to S3
after push
. You can take full advantage of the GitHub deploy key, which has fewer permissions as personal access tokens and can be configured per repository.
Please take a look at github-bucket, it might help you too.
Rather than using an AWS service directly (as you say they nearly all expect a much more complicated setup, deploying to EC2 etc), you might be better off using a CI provider such as Shippable, Codeship or Wercker.
These all have the ability to fire from git
updates, run build commands, install utilities into their CI images/containers and copy files to S3.
There's probably some startup which has built an exact tool for your purpose, but they haven't appeared on my radar yet :-)
I know it's not git deploy.... But Instead of setting up a CI box, I just used s3cmd.
Executing this command syncs my build directory with s3.
s3cmd sync -r ~/code/mysite/build s3://www.mysite.com --delete-removed
I'm using it on Linux. Not sure what their OSX and Windows stories are.
If you're really after a git push solution, you could set up a timed job which pulls your git repo to a folder and then executes this against it. I do this elsewhere on a cheap Linux VM. Unless you're going to go full CI though, there's probably not much point.