How to Monitor EC2 with CloudWatch and Send Alerts to Email & Slack
Keeping track of your AWS resources is critical. You don’t want to find out your server is overloaded from your customers — you want AWS to tell you first! In this post, we’ll set up monitoring for an EC2 instance using CloudWatch, send alerts with SNS, and push them straight into Slack for your team.
By the end, you’ll have a full end-to-end notification system:
CloudWatch → Alarm → SNS → Email + Slack ✅
🔧 Prerequisites
- An AWS account with at least one running EC2 instance.
- A valid email address (for notifications).
- A Slack workspace where you can install AWS Chatbot.
Step 1: Create an SNS Topic
- In the AWS Console, search for SNS.
- Click Topics → Create topic.
- Choose Standard type.
- Name it something like
ops-alarms. - Create the topic.
Add an email subscription:
- Open your new topic → go to Subscriptions → Create subscription.
- Protocol: Email.
- Endpoint: your email address.
- Confirm the subscription from your inbox (AWS will send a link).
📩 Once confirmed, SNS can now notify your email directly.
Step 2: Create a CloudWatch Alarm for CPU
- Open the CloudWatch console → go to Alarms → Create alarm.
- Choose metric: EC2 → Per-Instance Metrics → CPUUtilization for your instance.
- Statistic: Average.
- Period: 5 minutes.
- Condition: Greater than 80%.
- Action: Send notification to your SNS topic (
ops-alarms). - Name the alarm
High-CPU-Alarm.
✅ Now if your instance CPU crosses 80% for 5 minutes, CloudWatch will publish to SNS.
Step 3: Integrate with Slack (via AWS Chatbot)
-
In the AWS Console, search for Chatbot.
-
Choose Slack → Configure new client.
-
Authorize your Slack workspace.
-
Select a channel (e.g.,
#aws-alerts). -
Create an IAM role:
- Role name:
AWSChatbot-role. - Policy template: Notification permissions.
- Role name:
-
Under Notifications, attach your SNS topic (
ops-alarms). -
Save the configuration.
✅ Now Slack is wired up to receive alerts from SNS.
Step 4: Test the Setup
Let’s make sure everything works:
- Edit the alarm and temporarily set the threshold to 1% CPU.
- Within a few minutes, the alarm will switch to ALARM state.
- Check your inbox → you should see an email notification.
- Check Slack → you should see the same alert in your channel.
🎉 Success! You’ve got real-time alerts in multiple places.
🎯 Conclusion
With just a few steps, we built a monitoring system that:
- Watches your EC2 instance CPU with CloudWatch Metrics.
- Alerts you via SNS.
- Delivers notifications to both email and Slack.
This gives you and your team visibility before things go wrong, helping you stay proactive.
Next steps:
- Add more alarms (disk space, status checks, network I/O).
- Secure your environment with CloudTrail for auditing.
- Automate setup using Terraform for repeatability.