You need to setup an AWS SNS HTTPS endpoint for this integration!
AWS Elastic Beanstalk can run applications in various languages and frameworks. AWS Elastic Beanstalk Notifications are triggered by notable events include environment creation errors and all changes in environment and instance health. You can get either all event types or none; there is no filter feature available in Elastic Beanstalk. That’s why marbot filters them to exclude notifications where the status has changed to Info or Ok.
I provide an easier way to setup Elastic Beanstalk monitoring. Checkout my Monitoring Jump Start!
- Visit https://console.aws.amazon.com/sns/?region=us-east-1
- Click on the Topics link on the left
- Select the topic that you created for marbot
- Click on the Actions button, where you click on the Edit topic policy link.
- Select the Advanced view tab
If this is the first time you edit the SNS topic policy, you should see a default entry like this:
If you see the default entry, go to the next step. Otherwise, replace it with this policy:
- Replace ARN with your SNS topic ARN that you created for marbot.
- Replace ACCOUNT_ID with your AWS Account ID.
- Click on the Update policy button to save the policy.
Now, AWS is allowed to send messages to your topic.
You need an existing Elastic Beanstalk environment for this example to work!
Unfortunately, Elastic Beanstalk (EB) notifications can not be configured to use an SNS topic using the graphical AWS Management Console. Instead, you have to use the AWS CLI to use the option in the aws:elasticbeanstalk:sns:topics namespace.
The command will add the option value to the
aws:elasticbeanstalk:sns:topicsnamespace without touching the other namespaces. If you have existing options defined in the
aws:elasticbeanstalk:sns:topicsnamespace it will override those values.
Replace the following values in the command below:
- APPLICATION_NAME with the name of the EB application
- ENVIRONMENT_NAME with the name of the EB environment
- TOPIC_ARN with the SNS topic ARN that you created for marbot
And run the command in your terminal to enable SNS notifications:
aws --region us-east-1 elasticbeanstalk update-environment \
When the environment state changes, e.g. because you deploy a new application version, you should receive an alert in Slack: