Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best strategy to deploy static site to s3 on github push? [closed]

I'd like to automate deploying our site to AWS S3. I've written a node script to automate building and uploading the site, but I'd like to have the script automatically run whenever the master branch of our repo is updated on github.

I looked into AWS CodeDeploy, but it looks like that's for specifically deploying to EC2. I've also looked at AWS Lambda, but there doesn't seem to be a clear way to pull a copy of the repo using git so I can run the script.

Any services (preferably tied to AWS) that I can use?

like image 561
Mike Douglas Avatar asked Sep 11 '15 18:09

Mike Douglas


People also ask

Which S3 feature can be used to host static website?

To enable static website hosting Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to enable static website hosting for. Choose Properties. Under Static website hosting, choose Edit.


1 Answers

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.

github-s3-deploy-architecture

like image 178
Matthias Avatar answered Sep 17 '22 21:09

Matthias