Monitor Elastic Beanstalk with CloudWatch metrics, alarms, and SNS

Michael Wittig – 14 Mar 2018 (updated 17 Aug 2021)

AWS Elastic Beanstalk is a platform to run your applications on AWS. Elastic Beanstalk also provides features to help you to monitor your applications. In this post, we look at those features and how you can use them to monitor EB.

CloudWatch metrics

Each EC2 instance sends metrics to CloudWatch that we can monitor with CloudWatch alarms. We recommend creating alarms for the following metrics:

  • CPUUtilization: The percentage of CPU used.
  • CPUCreditBalance: The number of CPU credits left (only applies to t* instance types).

Elastic Beanstalk comes with a mechanism to customize environments that you can use to automate the creation of CloudWatch alarms.

  1. In your Elastic Beanstalk project’s source code, create a folder .ebextensions.
  2. Copy a file such as marbot-elastic-beanstalk.config into the .ebextensions folder (file must end with .config!).
  3. Adjust the MarbotEndpointId option_settings in the marbot-elastic-beanstalk.config file.
  4. Deploy the application.

Events via SNS

Besides metrics, Elastic Beanstalk sends out notifications if the state of the environment has changed. E.g., because of a failed deployment.

AWS does not support filtering the notifications. You likely end up with a lot of noise and the risk of missing the critical notifications without a custom filter.

Set up instructions

Monitoring Setup Assistant
Monitor Elastic Beanstalk and receive alerts in Slack or Microsoft Teams! marbot filters the events for you as well.

  1. Add marbot to Slack or Microsoft Teams.
  2. Invite marbot to a channel.
  3. In the channel, type:
    @marbot Monitor Elastic Beanstalk
  4. Hit enter and follow the wizard.
Michael Wittig

Michael Wittig

Consultant focusing on Amazon Web Services (AWS). Entrepreneur building marbot.io. Author of Amazon Web Services in Action, Rapid Docker on AWS, and cloudonaut.io.

You can contact me via Email, Twitter, and LinkedIn.

Published on and updated on

marbot teaser

Chatbot for AWS Monitoring

Configure monitoring for Amazon Web Services: CloudWatch, EC2, RDS, EB, Lambda, and more. Receive and manage alerts via Slack. Solve incidents as a team.

Slack
Add to Slack
Microsoft Teams
Add to Teams