Deploying GIT onto Amazon Elastic Beanstalk (AWS)

August 17, 2013 by Andrew Seymour

Cloud services are awesome but really, they only truly work when deployment is easy and manageable. I have to say, Amazon’s deployment is more complex than Microsoft’s and this isn’t a game of top trumps, this comes down to a case of usability and speed of setup (no one wants to spend all their time running command line applications to get something set up).

I’ll briefly explain how it works on Azure (and this in my opinion is just a case of how Amazon should implement their deployment process). So when you setup a project on Azure you select where the application is coming from, in my case, I selected Github which it started an authorisation process with my Github account using OAuth so I didn’t even need to enter my password.

I select the repository from the list it pulled in from my Github account, after which I enter the branch that I want to pull from and that’s it! It automatically starts deploying – and here’s the awesome bit, it set Github to automatically push changes from that branch to Azure so automatically deployment of future commits – which is nice.

However, on the Amazon side deploying Github via Windows is a little bit more difficult – so let me run through the process. So bare in mind that I’m deploying on an EU instance (Ireland) so I’m using the settings for that, yours depending on where you’ve selected might be different, also, this is assuming you already have an instance/environment deployed.

Firstly, get the tools from and extract the ZIP anywhere you want (you’ll only be using 2 BAT files from it), firstly, go to AWS DevTools/Windows and run AWSDevTools-OneTimeSetup.bat (no real idea what this does but hey, the documentation says to run it). Next (this part is assuming you already have a Git repository or are using the Github for Windows application as that’ll work too) copy the AWSDevTools-RepositorySetup.bat from that directory into the root of your Git application and run it (it shouldn’t error however if it does, the documentation recommends for you to retry the one time setup bat file).

As a side note here, make sure you don’t commit AWSDevTools-RepositorySetup.bat __as that’s probably not a good idea. So, if you’re using Git you’re probably already command line, if not, if you’re in the Github application, right click the repository you want to -> open shell and type git aws.config – it should start asking you questions like (some are example answers others are the answers I gave);

  • AWS Access Key = find this in your account security
  • AWS Secret Key = find this in your account security
  • AWS Region = eu-west-1
  • AWS Application = myapp
  • AWS Host =
  • AWS Environment  = myapp-env (basically, what it is on Elastic Beanstalk – usually has “env” afterwards – completely unlike the example they give).

And that’s that, remember to add an ignore for the folder .elasticbeanstalk as that folder is created inside your Git application – don’t be committing that. Now you’ll want to push it, through command line type git aws.push and soon you’ll see Amazon’s Elastic Beanstalk start pushing your application out, it can take a few minutes and you’re application will be live!

Hopefully, you can see from this, Azure’s offering is a lot simpler, and Amazon could really simplify this process if they wanted to but hopefully this helps you to start deploying on Amazon Elastic Beanstalk with Git/Github on Windows.

Categories: Amazon, Cloud, Microsoft, PHP, Servers, Software, Windows

Tags: amazon, aws, cloud, elastic beanstalk, git, php