Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Configuring Amazon SNS Notifications with Elastic Beanstalk

You can configure your AWS Elastic Beanstalk environment to use Amazon Simple Notification Service (Amazon SNS) to notify you of important events affecting your application. Specify an email address during or after environment creation to receive emails from AWS when an error occurs or your environment's health changes.

Note

Elastic Beanstalk uses Amazon Simple Notification Service for notifications. For details on Amazon SNS pricing, see https://aws.amazon.com/sns/pricing/.

When you configure notifications for your environment, Elastic Beanstalk creates an Amazon SNS topic for your environment. When a notable event occurs, Elastic Beanstalk sends a message to the topic. Amazon SNS relays messages it receives to the topic's subscribers.

Notable events include environment creation errors and all changes in environment and instance health. Events for Auto Scaling operations (adding and removing instances from the environment) and other informational events do not trigger notifications.


        Notification email

The Elastic Beanstalk console lets you enter an email address during or after environment creation to create an Amazon SNS topic and subscribe to it. Elastic Beanstalk manages the lifecycle of the topic, and deletes it when your environment is terminated or you remove your email address in the environment management console.

The aws:elasticbeanstalk:sns:topics configuration option namespace provides options for configuring an Amazon SNS topic in configuration files, or by using a CLI or SDK. These methods let you configure the type of subscriber as well as the endpoint, so that the subscriber can be an SQS queue or HTTP URL.

Amazon SNS notifications can only be turned on or off. Depending on the size and composition of your environment, the frequency of notifications sent to the topic can be high. For notifications that are only sent under specific circumstances, you can configure your environment to publish custom metrics and set Amazon CloudWatch alarms to notify you when those metrics reach an unhealthy threshold.

Configuring an Amazon SNS topic in the Elastic Beanstalk console

The Elastic Beanstalk console lets you enter an email address during or after environment creation to create an SNS topic for your environment.

During environment creation, enter an Email address on the Configuration Details page:


          Elastic Beanstalk Launch Wizard

On a running environment, enter an Email on the environment configuration menu under Notifications:


          Elastic Beanstalk Configuration Menu

When you enter an email address in either of these locations, Elastic Beanstalk creates an SNS topic for your environment and adds a subscription. SNS sends an email to the subscribed address to confirm the subscription. You must click on the link in the confirmation email to activate the subscription and receive notifications.

The aws:elasticbeanstalk:sns:topics Namespace

Use the options in the aws:elasticbeanstalk:sns:topics namespace to configure SNS notifications for your environment. These options can be set by using configuration files, a CLI or an SDK.

Notification Endpoint – Email address, SQS queue, or URL to send notifications to. Setting this option creates an SQS queue and a subscription for the specified endpoint. If the endpoint is not an email address, you must set the Notification Protocol option as well. SNS validates the value of Notification Endpoint based on the value of Notification Protocol. Setting this option multiple times creates additional subscriptions to the topic. Removing this option deletes the topic.

Notification Protocol – The protocol used to send notifications to the Notification Endpoint. This option defaults to email. Set this option to email-json to send JSON formatted emails, http or https to post JSON formatted notifications to an HTTP endpoint, or sqs to send notifications to an SQS queue.

Note

Lambda notifications are not currently supported.

Notification Topic ARN – After setting a notification endpoint for your environment, read this setting to get the ARN of the SNS topic. You can also set this option to use an existing SNS topic for notifications. A topic that you attach to your environment with this option is not deleted when this option is changed or the environment is terminated.

Notification Topic Name – Set this option to customize the name of the SNS topic used for environment notifications. If a topic with the same name already exists, Elastic Beanstalk attaches that topic to the environment.

Warning

If you attach an existing SNS topic to an environment with Notification Topic Name, Elastic Beanstalk will delete the topic if you terminate the environment or change this setting.

Changing this option also changes the Notification Topic ARN. If a topic is already attached to the environment, Elastic Beanstalk deletes the old topic, and then creates a new topic and subscription.

The EB CLI and Elastic Beanstalk console apply recommended values for the preceding options. These settings must be removed if you want to use configuration files to configure the same. See Recommended Values for details.