What’s the simplest way to make a git push on a branch automatically deploy to my AWS Elastic Beanstalk environment?

I want to be able to make a commit to my repo via GitHub WebUI, and have a webhook start a eb deploy process of the new HEAD commit automatically.

I understand there are tools for this (CodePipeline/CodeDeploy), but it isn’t clear if those tools work with Elastic Beanstalk. Using such a comprehensive solution for such a simple problem also seems like over-engineering (read: unnecessary overhead). Surely there is a simpler way.

Background:
The app I’m working on outgrew its shared host environment, so I moved it to AWS using Elastic Beanstalk. Previously I was auto-deploying updates on a shared host with a simple PHP script. When I would git push, the webhook would hit that script via HTTP, and the script would run a git pull origin mybranch, which would retrieve any updated files.

Right now I can log into a Cloud9 IDE to git pull && eb deploy code updates, but this isn’t an ideal solution if I want to let other developers deploy changes.

I tried re-implementing that old solution on Elastic Beanstalk, but the ephemeral nature of EC2 instances means I can’t save a SSH keypair or known_hosts on there.

Answer

Have you checked out the EB integration with Git,

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html

And this question might be more suited for Stackoverflow, with the same tag.

Attribution
Source : Link , Question Author : Eric Seastrand , Answer Author : AYA

Leave a Comment