4.2.5 Implement Notification Alerts

Notification Alerts for Specific Actions

CloudWatch Alarms

States: OK → ALARM → INSUFFICIENT_DATA
ActionTarget
SNSEmail, SMS, Lambda, HTTP
Auto ScalingScale in/out
EC2Stop, terminate, reboot

Useful Alarms

MetricThresholdAlert
Lambda Errors> 5 in 5 minSNS → Ops team
Lambda Throttles> 0SNS → Scale alert
SQS AgeOfOldestMessage> 300sSNS → Consumer lag
DynamoDB ThrottledRequests> 0SNS → Capacity alert
API Gateway 5XXError> 1%SNS → Incident

Composite Alarms

  • AND/OR logic combining multiple alarms
  • Reduce noise: Alert only when multiple conditions met
  • Example: CPU high AND error rate high

Quota Limit Notifications

Scenario thi: Configure notification về quota limits

Giải pháp:

  • CloudWatch alarms notify khi approaching quota value threshold
  • Quota data có thể được saved trong CloudTrail
  • AWS Service Quotas integration
  • Trusted Advisor checks

Ví dụ: Automation alert via email khi reach defined percentage của WorkSpaces quota

# Lambda to gather total WorkSpaces deployed
# Send SNS email when quota breached
# EventBridge Rule to trigger Lambda

Deployment Completion Notifications

AWS CodeStar Notifications:

  • Subscribe to events trong CodeBuild, CodeCommit, CodeDeploy, CodePipeline
  • Receive notifications khi deployment completes
  • SNS topic integration
# CodePipeline → SNS on stage completion
- Name: NotifyOnDeploy
  Actions:
    - Name: SNSNotify
      ActionTypeId:
        Category: Approval
        Provider: Manual
      Configuration:
        NotificationArn: !Ref AlertTopic

CloudWatch Anomaly Detection

  • Machine learning-based anomaly detection
  • Automatically creates alarm thresholds
  • Adapts to metric patterns over time
  • Reduces false positives

API Gateway Cache Metrics

Scenario thi: Application metrics related to cache hits/misses với API Gateway + Lambda không populate trên CloudWatch dashboard.

Root cause: Không monitor API executions, thiếu wider view của application performance.

Giải pháp: Enable API Gateway caching và monitor:

  • CacheHitCount
  • CacheMissCount
  • Add to CloudWatch dashboard

Exam Tip:

  • Composite Alarms reduce noise
  • SNS for notifications
  • Service Quotas for limit monitoring
  • CodeStar Notifications for CodeBuild/CodeCommit/CodeDeploy/CodePipeline events
  • CloudWatch alarms có thể notify về quota limits
  • Quota data saved trong CloudTrail