North-Seattle-College / ad440-winter2021-thursday-repo

NSC AD 440 Winter 2021 Thursday cohort practicum repo
Apache License 2.0
2 stars 27 forks source link

Create alerts for error 500 generated by the /users/{user_id} API – API in AWS using CloudWatch – more than 10 errors 500 within 5 mins #254

Closed yergu closed 3 years ago

yergu commented 3 years ago

Is your feature request related to a problem? Please describe. This feature is to create alert functionality for 500 error generated for more than 30 times in 5 mins using AWS CloudWatch Describe the solution you'd like The idea is to create an alert and send email notification
Additional context The testing for this was done against the users/userid endpoint as it was creating 500 errors.

Date Activity Time Spent
03/9/2021 Setting up issue 15 mins
03/11/2021 Researching 4 hour
03/14/2021 Configuring the alert 1hour
03/0115/2021 testing and updating 1 hour
03/16/2021 testing and updating 1 hour
03/19/2021 testing and Fix errors 1 hour

Steps to create Alert 1. create SNS topics for the email notification image

  1. Configure the Alarm

To create a metric filter using the CloudWatch console

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.
  2. In the navigation pane, choose Log groups.
  3. Choose the name of the log group.
  4. Choose Actions, Create metric filter.
  5. For Filter pattern, enter the filter pattern to use “Error 500”
  6. Click on test your filter pattern, under Test Pattern,
  7. Choose Next, and then enter a name for the filter.
  8. Under Metric details, Enter the Metric namespace,and Metric value,
  9. confirm metric filter was created then check box right upper corner
  10. confirm "create alarm" is clickable
  11. In the Create alarm window specify the metric and conditions
  12. Put threshold 10
  13. In Select an SNS topic section select an existing SNS topic or create new topic (In my case since I already Created the topic I selected “Yergu Topic”
  14. Then Click Next
  15. In the Create Alarm window Specify Name and description of Alarm and Then click Next Triger the Error by changing the DB password or name
  16. Go to lambada Function and test the ApI if the Error created Expected Result

1, Alarm is created image

2. And Email notification send image

jinudean commented 3 years ago

nice job y