Creating Alarm and SNS
Creating Alarm and SNS
Use Amazon CloudWatch Alarm combined with Amazon SNS to send email notifications whenever your API encounters an error. This is applicable when your API is running on AWS (Lambda, API Gateway, etc.).
Objectives
- Monitor errors (e.g., 5XX in API Gateway, error count in Lambda).
- When errors exceed a specified threshold → send email alerts.
Steps to implement
- Go to the CloudWatch Console
- Choose Alarms → Create Alarm



- Choose Error (Metric name)

- Configure the conditions for SNS to work smoothly when an error occurs


- Create a new SNS topic to use with the Alarm. Enter the email address you want to receive alerts in the Email endpoint field.

- Click Next, then name your alarm

- Finally, review the selected configurations and click Create
Note: If you want to create an alarm for API Gateway, at the initial Select metric step, choose API Gateway → By Stage → Method → 5XXError.
The remaining steps are the same as above.
- Email Notification Result When the System Encounters an Issue:
