A CPU alarm flaps between `OK` and `ALARM` every few minutes and pages the on-call engineer all night.
IntermediateTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer
Likely causes → The alarm uses 1 datapoint of 1 over a short period on a noisy metric. Or missing data is treated as breaching while the metric is published irregularly.
Diagnose →
aws cloudwatch describe-alarm-history --alarm-name web-cpu --history-item-type StateUpdate --max-items 20 \
--query 'AlarmHistoryItems[].[Timestamp,HistorySummary]'
aws cloudwatch describe-alarms --alarm-names web-cpu \
--query 'MetricAlarms[].[Period,EvaluationPeriods,DatapointsToAlarm,TreatMissingData,Threshold]'
Fix →
aws cloudwatch put-metric-alarm --alarm-name web-cpu --namespace AWS/EC2 --metric-name CPUUtilization \
--dimensions Name=AutoScalingGroupName,Value=web-asg --statistic Average --period 60 \
--evaluation-periods 5 --datapoints-to-alarm 4 --threshold 85 --comparison-operator GreaterThanThreshold \
--treat-missing-data notBreaching --alarm-actions <sns-arn>
Use composite alarms (for example, high CPU and high latency) for paging.
Prevent → Page on symptoms (SLO burn, errors, latency) and send resource alarms to tickets.
More on CloudFormation, CloudWatch, KMS, Secrets and Cost
Updating a stack fails: `Stack:arn:aws:cloudformation:...:stack/app/... is in ROLLBACK_COMPLETE state and can not be updated.`BeginnerA stack is stuck in `UPDATE_ROLLBACK_FAILED`.AdvancedA pipeline fails with `An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.`Beginner`InsufficientCapabilitiesException: Requires capabilities : [CAPABILITY_NAMED_IAM]`.BeginnerStack deletion ends in `DELETE_FAILED` with `The bucket you tried to delete is not empty` on an S3 bucket resource.IntermediateDrift detection shows `MODIFIED` on a security group and an RDS instance that someone changed in the console. How do you reconcile?Advanced