CloudWatch & SNS Integration for Real-Time Error Alerts in Dev and Prod Environments #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements centralized logging, monitoring, and alerting for EC2-based deployments using AWS CloudWatch and SNS, fulfilling the requirements of Assignment 5.
✅ CloudWatch Logs and Metrics
Application logs are collected and pushed to CloudWatch under stage-specific log groups such as:
A CloudWatch Log Metric Filter tracks error-level log entries:
Corresponding CloudWatch Alarms are configured to trigger based on the above metric.
🔔 SNS-Based Alerting
☁️ Free Tier Optimization
The solution uses:
Log data is kept minimal (few KBs) and uses short retention to avoid costs.
📥 Example Outputs and Alerts
Below is a screenshot of the email alert received via SNS when an

Error
log is detected:Below is screenshot of AWS CloudWatch alarms

CloudWatch log groups showing stage-specific separation:
dev
log group:prod
log group:Below is

AWS SNS
topic:🔍 Validation
echo "Error"
or `echo "Exception"' in EC2 logs correctly triggers the alarm and sends the email.This feature/assignment
[devops/a5]
continues from[devops/a4]
and has been raised on[main]
to maintain a clear history of each assignment.