After months of using Elastic Beanstalk to make automated deployments work the way we wanted them to, we moved on to CodeDeploy, and it has since then become one of our favorite tools in the AWS toolbox.

The way is works is rather simple. As shown in the diagram below, the developer commits his code to GitHub (or BitBucket, or whatever else you are using). The Jenkins job polls the repository for new code, and when it finds it, it builds, and creates an archive which it posts to an S3 bucket.

We had originally used Lambda to detect the new archive and startup CodeDeploy when it was time to push, but have since then started using the AWS CodeDeploy plugin for Jenkins (

Code deploy uses a .yml script which allows you to indicate what you want to do once the archive is in S3. Generally speaking, for a Java/Tomcat application, you are going to want to undeploy the old version, delete it, install the new version, and restart your Tomcat. We see no point in keeping the old version around since you can always roll back to a previous version on GitHub, but if you feel the need to hang on to it, you can simply move it out of the webapps folder.

WE also use this for some of our clients PHP distributions, as well as our own WordPress website. It is clean, fast and efficient. Let us know if you need help setting this up for your own teams.