Amazon EventBridge, SNS and AWS Health: Event-Driven Alerts, Notifications and Scheduled Operations
EventBridge Concepts
| Term | Meaning |
|---|---|
| Event | JSON describing a change (source, detail-type, detail, account, region, time) |
| Event bus | Default bus (AWS service events), custom buses (your apps), partner buses (SaaS) |
| Rule | Event pattern (or schedule) + one or more targets |
| Target | Lambda, SNS, SQS, Step Functions, SSM Automation / Run Command, ECS task, Kinesis, API destination (HTTP), another bus, CodePipeline, and more |
| Input transformer | Reshape the event before sending to the target |
| Archive and replay | Store events and replay them for testing or recovery |
| Pipes / Scheduler | Point-to-point integration, and flexible one-time or recurring schedules |
Event Patterns
json
{
"source": ["aws.ec2"],
"detail-type": ["EC2 Instance State-change Notification"],
"detail": {"state": ["stopped", "terminated"], "instance-id": [{"prefix": "i-0"}]}
}
json
{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"],
"detail": {"severity": [{"numeric": [">=", 7]}]}
}
- Patterns match by content: exact values,
prefix,anything-but,numeric,exists,cidr, and wildcard - Test a pattern with the console Sandbox or
aws events test-event-pattern
bash
aws events put-rule --name ec2-stopped --event-pattern file://pattern.json
aws events put-targets --rule ec2-stopped --targets "Id"="1","Arn"="arn:aws:sns:ap-south-1:111111111111:ops-alerts"
aws events list-rules --query 'Rules[].[Name,State]'
aws events put-events --entries '[{"Source":"shop.app","DetailType":"OrderPlaced","Detail":"{\"id\":42}"}]'
Permissions A rule needs permission to call its target. For SNS, SQS and Lambda use the resource-based policy on the target (console adds it). For other targets (SSM, ECS, Step Functions) use an IAM role for the rule.
Common Operational Event Rules
| Event source | Typical reaction |
|---|---|
| EC2 state change | Notify, tag, update CMDB |
| CloudWatch alarm state change | Start SSM Automation, open ticket |
AWS Health (aws.health) | Notify owners before maintenance or retirements |
| GuardDuty / Security Hub / Config compliance change | Auto-isolate, notify security |
CloudTrail API call (for example ConsoleLogin, DeleteBucket) | Alert and audit |
| Backup job failed | Page the on-call |
| Auto Scaling events | Log, notify, trigger lifecycle actions |
| ECS task state change | Track failures |
| Scheduled (cron) rule | Run housekeeping Lambda or SSM Automation |
Scheduled Operations
bash
aws events put-rule --name nightly-cleanup --schedule-expression "cron(30 20 * * ? *)" # UTC
aws scheduler create-schedule --name stop-dev --schedule-expression "cron(0 19 ? * MON-FRI *)" --schedule-expression-timezone "Asia/Kolkata" \
--flexible-time-window Mode=OFF --target '{"Arn":"arn:aws:scheduler:::aws-sdk:ec2:stopInstances","RoleArn":"arn:aws:iam::111111111111:role/SchedulerRole","Input":"{\"InstanceIds\":[\"i-0abc\"]}"}'
- EventBridge Scheduler supports time zones, one-time schedules, retries, DLQ, and universal targets (call most AWS APIs directly)
- Classic rule cron uses UTC and six fields (
minute hour day month weekday year)
Amazon SNS
| Concept | Meaning |
|---|---|
| Topic | Pub/sub channel. Standard (best-effort ordering, high throughput) or FIFO (ordering, dedup) |
| Subscription protocols | Email, SMS, HTTP/S, Lambda, SQS, Firehose, mobile push |
| Fan-out | One publish → many subscribers (for example SNS → several SQS queues) |
| Filter policy | Subscribers receive only matching messages (message attributes or body) |
| Delivery retries & DLQ | Set a redrive policy (SQS DLQ) per subscription to capture failures |
| Encryption & access | KMS (CloudWatch and EventBridge need key access), topic policy for cross-account and service publishers |
bash
aws sns create-topic --name ops-alerts
aws sns subscribe --topic-arn $T --protocol email --notification-endpoint oncall@example.com
aws sns subscribe --topic-arn $T --protocol sqs --notification-endpoint $Q --attributes '{"FilterPolicy":"{\"severity\":[\"high\"]}","RawMessageDelivery":"true"}'
aws sns publish --topic-arn $T --subject "Test" --message "hello" --message-attributes '{"severity":{"DataType":"String","StringValue":"high"}}'
| Notification not delivered? | Check |
|---|---|
| Email never arrives | Subscription still PendingConfirmation, spam folder |
| Alarm did not publish | Topic policy lacks permission for cloudwatch.amazonaws.com or events.amazonaws.com, KMS key policy, wrong Region |
| SQS gets nothing | SQS queue policy must allow the topic |
| Lambda not invoked | Lambda resource policy allows sns.amazonaws.com |
| SMS blocked | Sandbox limits, country rules, opt-outs, spend limit |
AWS Health
- AWS Health Dashboard - Your account shows events affecting your resources: scheduled maintenance, retirements (for example EC2 instance retirement, RDS maintenance), issues, expiring certificates
- Service health page shows public status of services
- Subscribe with EventBridge rules on
aws.healthand send to SNS, Chatbot, tickets - Organizational view aggregates events across accounts (needs Business/Enterprise support plans for the Health API)
json
{"source": ["aws.health"], "detail-type": ["AWS Health Event"], "detail": {"service": ["EC2", "RDS"], "eventTypeCategory": ["scheduledChange", "issue"]}}
ChatOps and User Notifications
- AWS Chatbot (Amazon Q Developer in chat applications) sends alarms and events to Slack, Microsoft Teams, Chime and lets approved users run CLI commands
- AWS User Notifications centralizes notifications for many services into email, chat and the console mobile app
A Complete Alerting Flow
text
CloudWatch alarm (ALARM) ──► EventBridge default bus ──► rule
├─► SNS topic ──► email / Chatbot to Slack (humans)
├─► SSM Automation (auto-remediation)
└─► Lambda ──► create ticket (Jira/ServiceNow)
Failures at each hop ──► DLQ (SQS) + alarm on DLQ depth
Practice Tasks
- Create an EventBridge rule for EC2
stoppedevents that publishes to SNS - Build a rule for
aws.healthscheduledChange events - Schedule a stop of dev instances at 19:00 IST with EventBridge Scheduler
- Create an SNS topic with two SQS subscribers using filter policies
- Send alarms to Slack with Chatbot and test with
set-alarm-state
Conclusion
EventBridge routes events by pattern to many targets and runs schedules (use Scheduler for time zones). SNS fans out notifications with filters and DLQs. AWS Health tells you about maintenance and retirements affecting your resources. Wire alarms and events to humans through SNS and Chatbot and to machines through SSM Automation and Lambda.
Quick Summary: EventBridge; patterns; operational rules; scheduling; SNS; Health; ChatOps; alert flow.

