Deploy Datadog on AWS Elastic Beanstalk

Deploy Datadog on AWS Elastic Beanstalk

/ / /
Published: May 7, 2014

David Caplan @davc is the Chief Technology Officer at SolveBio and runs his own blog, davecap.com.

At SolveBio we use AWS Elastic Beanstalk to manage some of our apps on EC2. Our API for biomedical data is critical for running diagnostic tests, so we like to keep an eye on its performance. We started using Datadog a few weeks ago to help us out with monitoring and metrics, but we ran into some issues getting it to play nicely with Elastic Beanstalk. This article describes how we got it all working together.

How SolveBio uses Elastic Beanstalk

Similar to Heroku, Elastic Beanstalk makes it super easy to deploy various web apps to EC2. At SolveBio, we mostly work with Python and Node.js, so the method described here focuses on those stacks. The Datadog agent is a daemon managed by supervisord, which sends system metrics to Datadog but also works as a statsD proxy.

One kink we initially encountered was that the Datadog agent and Elastic Beanstalk rely on separate installations of supervisord. This confuses the heck out of Elastic Beanstalk. Luckily, getting past this kink is simple. You just have to tell Elastic Beanstalk to stop Datadog before deploying and start it again when you’re done.

Before continuing, make sure you’ve read the Elastic Beanstalk Getting Started Guide and Customizing and Configuring a Python Container.

Deploy the Datadog agent on Elastic Beanstalk

Once your project is all set up for Elastic Beanstalk, create the .ebextensions, .ebextensions/datadog, and .ebextensions/datadog/hooks directories, and pop in the following files:

.ebextensions/99datadog.config

.ebextensions/datadog/datadog.repo

.ebextensions/datadog/hooks/99start_datadog.sh

.ebextensions/datadog/hooks/99stop_datadog.sh

Once all the files are in there, commit the changes and then deploy your app using git aws.push. The agent should be installed once the update finishes, and it should also keep working after further deploys to your Elastic Beanstalk instances. We found it helpful to enable SSH login to our instances for debugging.

Now the Elastic Beanstalk monitoring fun begins

Now that we’re up and running, monitoring AWS Elastic Beanstalk with Datadog has already proven to be very helpful. With that said, we’re still getting acquainted with Datadog so I’ll be back in a few weeks to share my thoughts on key AWS Elastic Beanstalk metrics to monitor and any tips and tricks or best practices I’ve gained. In the meantime, if you’d like to gain visibility into your AWS Elastic Beanstalk performance you can .


Want to write articles like this one? Our team is hiring!