aws-lambda
aws-lambda copied to clipboard
TopicARN
Hi, I have followed all the steps and so far I have been able to successfully send notifications using test data. However, it's not triggering on actual EB instance triggers. What I have done so far:
- Tested the lamba function with dummy data (its sending notifications).
- Created an SNS topic and subscription and for the protocol, I put in the lamba function ARN. I believe I'm failing to properly do the final step:
Add the Topic ARN as Notification setting to your Elastic Beanstalk environment configuration:
At the root of the project I have the config setup like this: https://jmp.sh/BWEDzFA and the config contains this:
option_settings:
aws:elasticbeanstalk:sns:topics:
# Send deployment and health notifications to this Amazon SNS topic:
NotificationTopicARN: arn:aws:sns:us-east-1:554436049797:draftxr-eb-slack-notifs
Thank you for building this tool. Saved me a ton of time writing it from scratch. Looking forward hearing back from you.
Hi @SaudTauqeer , I've updated (6901c04d35692f5ea418137b757530f338c6cec8) the documentation on where exactly the Topic ARN can be set.
The provided code sample has to be added to your Elastic Beanstalk Environment Manifest (env.yaml):
OptionSettings:
aws:elasticbeanstalk:sns:topics:
# Send deployment and health notifications to this Amazon SNS topic:
NotificationTopicARN: arn:aws:sns:eu-west-1:000000000000:eb-deployments
If you want to add this configuration via ebextensions instead, you have to use a different YAML syntax for the option settings:
option_settings:
- namespace: aws:elasticbeanstalk:sns:topics
option_name: NotificationTopicARN
value: arn:aws:sns:eu-west-1:000000000000:eb-deployments
I haven't tested the setting via ebextensions, but based on the documentation I believe this to be the correct syntax.
Hey, thanks for the reply. I added the config via .ebextensions
. seems like the config was successful because I am able to see the SNS here:
https://jmp.sh/ts3mO8w
However, I am still not receiving any notifications on slack where the dummy data still works.
I have tried a number of fixes but nothing seems to work. Any ideas what the issue might be? Are you still able to use the app?
Since you’re seeing the slack notifications when using dummy data (meaning the lambda function works) and you’re seeing the SNS notifications as well, sounds like this part is not correctly set up:
Create an Amazon SNS topic and add it as SNS trigger for the Lambda function.
This is from memory, but as far as I remember it’s easiest to add an SNS trigger for a lambda function from the function configuration interface.
To do it properly, it would be best to define everything declaratively via CloudFormation, but that’s probably too much effort.
I was facing the same issue and neither a config file in .ebextensions/
nor a env.yaml
in the root worked. Using the AWS CLI did work though as a workaround
aws elasticbeanstalk update-environment --environment-name <PUT ENVIRONMENT NAME HERE> --option-settings Namespace=aws:elasticbeanstalk:sns:topics,OptionName="Notification Topic ARN",Value="<PUT TOPIC ARN HERE>"
PS: Make sure your beanstalk ec2 role and service role have the necessary access for SNS otherwise you'll get Service:AmazonSNS, Message:Topic does not exist
.