All Articles

Beanstalk and back to plain old EC2

I really do love AWS Elastic Beanstalk. It’s the perfect technology to help auto-scale and deploy modern applications. But this power and flexibility does not come easy; the doc is pretty awful and the configuration files leave a lot to be desired. It can be great, if you’re willing to work for it.

It doesn’t help that AWS does a terrible job keeping their documentation updated. Most of the instructions for the previous generation either don’t apply or break under the new v3 implementation. And there are never enough real-world examples to get you going — too many snippets out of context to be helpful. Why not a complete example of deploying a Wordpress or NodeJS application?

A few things to consider:

  • The configuration files also have too many ways to accomplish the same thing. Some of this is due to changing syntax between v2 and v3, but some is just poor execution on Amazon’s part. Completely move the v2 doc, make it archived! Too many links point to old or out of date doc.
  • There is not true support for GIT branches in the v3 configuration files. For example, you can’t have multiple branched environments in a single configuration file. You really need to be able to set different variables and mount points for different environments (stage, prod). You are left making multiple copies of config files or using something like symbolic links. Not ideal.
  • Switching environments with development teams is too complicated. The doc oversimplifies it, you know, just “use stage” or “use prod” … but it doesn’t work that easily in practice. How would this ever work with GIT? It seems like they are moving away from true GIT integration anyway with v3.
  • The deploys take forever. There needs to be better checking for packages that haven’t changed so complete re-installs are avoided. You can do this, but it’s not trivial to implement and requires third party code. Why not deploy with package files with versions of packages as the default method for Beanstalk deploys? Grunt? Gulp?
  • Instances just stop working all of a sudden. They just hang. Then you upgrade the version of Linux and things start working again! I’ve mostly used Amazon Linux on Beanstalk, maybe it’s isolated, but I don’t think so. And you don’t get notified if the instance is hanging, and it will not auto-restart. This condition is not considered unhealthy by the Beanstalk monitoring agents which is pretty bad.

If you have an application that really needed horizontal scaling, take the time to architect a Beanstalk solution, it works well for the most part. You’ll need to setup a lot of monitoring and thoroughly test your configurations and backups. But if you can get away with vertical scaling, I’d go that route because it is simpler to implement and maintain.