Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up the CloudWatch -> SNS? #15

Open
pamelafox opened this issue May 22, 2017 · 8 comments
Open

Setting up the CloudWatch -> SNS? #15

pamelafox opened this issue May 22, 2017 · 8 comments

Comments

@pamelafox
Copy link

Hello! I've deployed the bot, but I have not set up any flow for Alarms to go into SNS queues, so there is nothing for the bot to process. Is there any suggested documentation/blog post on how to do that?

@creichert
Copy link
Member

Which AWS service do you want to receive events from? e.g. Elasitc Beanstalk, EC2, RDS, etc.

The basic process is:

  • Create an SNS subscription (my-test-subscription) and attach it to the Lambda Function
  • Pick a service, e.g. RDS
  • Create a CloudWatch alarm for that service
  • Configure the CloudWatch alarm to send events to the SNS subscription

For example, the assertible-rds-alarms is a SNS topic I created for our database

cloudwatch alarm to sns subscription

If you let me know what service you want to connect to, I can help out more.

@pamelafox
Copy link
Author

I am starting off with creating alerts for a different Lambda function. I have metrics that measure logs coming from that function, so I can set an alert based on the count of those logs, send those to an SNS, and see those piped through the Cloudwatch-Slack bot into our Slack channel.

Re the first step:

  • when I create a subscription in SNS, what protocol would I specify?
  • in what way should I attach the subscription to the Cloudwatch-Slack Lambda function?

I know how to do the subsequent steps, so I think I'll be set if you can clarify the first step further. Thanks so much!

@creichert
Copy link
Member

when I create a subscription in SNS, what protocol would I specify?

I'm not sure exactly what you mean by protocol (I could be missing something). If I go to create an SNS topic, I see this:

That's a separate step from any Lambda-specific functionality. I imagine if you already have a CloudWatch alarm for a Lambda function, you can navigate to it and set the SNS topic to propagate the events to, similar to the image I posted in the last comment. I'm a little lost on this part, but would be happy to help further if I could get a bit more info.

in what way should I attach the subscription to the Cloudwatch-Slack Lambda function?

For this one, navigate to your lambda-cloudwatch-slack notification (whatever you named it), and click the Triggers tab.

import-form-twitter-api-postman-collection-dry-run1

From there, you'll see an "Add trigger" at the bottom. Clicking that will get you into the right area to add the topic:

import-form-twitter-api-postman-collection-dry-run1

Let me know if that gets you further

@pamelafox
Copy link
Author

Great! Now I've got it all working. I was confused as your first comment said subscription, but I think actually meant "topic". (It appears that creating a CloudWatch alarm automatically creates the subscription to that topic).

So, the steps were:

  1. Create a topic in SNS. Call it CloudWatchNotifications OR change the name of what's in config.js.
  2. Create a CloudWatch alarm, and set its notification to go to the CloudWatchNotifications list
  3. Navigate to the Triggers tab of Lambda functions. Add a new trigger from SNS, specify CloudWatchNotifications list.

I think it'd help to put those steps in the README somewhere, along with the nice screenshots that you put here.
Thanks so much for the help! :-)

@pamelafox
Copy link
Author

I will confess I have another question, and hopefully it'd help others. I've moved on to setting up the Beanstalk notifications, and the UI there is a bit confusing.

screen shot 2017-05-22 at 2 25 53 pm
It desires an email address, even though I don't need it to go to an email. Do you just put something there anyway?

@creichert
Copy link
Member

That configuration dialog is definitely confusing. I generally configure w/o email and only rely on the SNS topics. What service did you take that picture from?

I agree with you on the doc improvements. Feel free to create a PR, if you want. We're committing more improvements, though, so I'll definitely add the suggestions when I have a chance.

@pamelafox
Copy link
Author

That screenshot was from Elastic Beanstalk -> Monitoring -> Alarm icon on upper right of the graph.
Where did you set your Beanstalk Alarms up, in CloudWatch?

Ok, I can send a PR after figuring this part out.

@myoung34
Copy link

myoung34 commented Nov 5, 2017

@pamelafox that UI (beanstalk) requires an email, which sucks.
You'll have to do this via settings{} blocks in your .config or via terraform/cloudformation.
You simply cant via the UI. I've opened a ticket with aws support 2 years ago and it hasnt moved. If you submit one as well as a feature request maybe theyll move it along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants