Interview Prep/AWS/CloudFormation, CloudWatch, KMS, Secrets and Cost

A CloudWatch alarm on a custom metric stays in `INSUFFICIENT_DATA` forever.

BeginnerTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer

Likely causes → The alarm's namespace, metric name or dimensions do not match exactly what is published (an alarm must specify all dimensions). Other causes: the period is shorter than the publish interval, or the metric stopped being sent.

Diagnose →

aws cloudwatch describe-alarms --alarm-names api-errors \
  --query 'MetricAlarms[].[Namespace,MetricName,Dimensions,Period,StateReason]'
aws cloudwatch list-metrics --namespace MyApp --metric-name Errors

Fix →

  1. Copy the exact dimension set from list-metrics into the alarm
  2. Make the period match the publishing rate
  3. For sparse metrics, set --treat-missing-data notBreaching

Prevent → Create alarms in the same IaC module that defines the metric names, and test alarms with set-alarm-state.

aws All AWS questions Roadmap: Cloud cost & architecture

More on CloudFormation, CloudWatch, KMS, Secrets and Cost