AWS Elastic Beanstalk - My Experiences

December 26, 2014 - 2 minute read -
aws elastic-beanstalk node heroku experience billing git logentries

After using Heroku for the past 12 months, I decided to try out Amazon's PaaS offering - Elastic Beanstalk.

Setup

I first decided created an application via the AWS console, by following the guided steps. However this actually just creates a sample application named 'My First Elastic Beanstalk Application'. It is not possible to rename it, so there's little point pushing your own code to it.

Amazon provies a Command Line Interface (CLI) for Elastic Beanstalk which was easy to install and setup. Creating a new application could then be initiated with:

eb init

Deployment

Code can be pushed from a git repository to EB with:

eb push

Then some 10 - 15 minutes later, the application will restart with the newly pushed code. This is quite painful compared to Heroku, which would be updated in seconds. I'd also find the CLI would give a timeout error, however the code would still get pushed correctly.

From reading a few Stack Overflow posts it does seem like the config can be tweaked to somewhat speed up pushes, but I didn't have much success.

Logs

Heroku's CLI has a 'logs' function which can easily be tailed, but sadly EB's CLI has no such feature. You can log directly into the EB EC2 instance and tail the log file, but this is still a headache. The AWS console provides a button to get the last 100 log lines. Rather than just display them though, it gives you a downloadable file, which is pretty cumbersome.

Logs are rotated every 15 minutes, which makes it hard when you just want to view what happened in the last hour.

Logentries

I had previously been using Logentries as an add-on for Heroku, so I decided to give it a go with AWS.

I first tried using the le_aws script, which logs an EC2 instance, detects all the logs and imports them into Logentries. It painless to run, however logging was often missing chunks of lines, most likely due to the AWS 15 minute log rotation.

I then switched to using node-logentries module within my application and found it much more reliable.

Billing

The AWS Free-tier gives you enough hours to run one EC2 instance and a DB constantly. With each application runnning on it's own instance, adding a 2nd or 3rd application will be outside the free tier. Whereas Heroku allows up to 100 applications.

Elastic IPs appear to be free for the first 5 as long as they are assigned to an EC2 instance. Otherwise you get charged for every hour they are not assigned but reserved to you, which is an easy trap to fall into.

There's also no way to set a spend limit. You can set up billing alerts, but there's still a chance of waking up to a huge bill if something goes wrong.