Skip to content

Instantly share code, notes, and snippets.

@hide32767
Created April 16, 2020 06:35
Show Gist options
  • Save hide32767/c933966dbb51b415a7b780162aad233a to your computer and use it in GitHub Desktop.
Save hide32767/c933966dbb51b415a7b780162aad233a to your computer and use it in GitHub Desktop.
sample of CloudWatch `put-metric-alarm` on AWS CLI
#!/bin/sh
aws cloudwatch put-metric-alarm \
--alarm-name 'アラーム名' \
--alarm-description 'アラームの説明' \
--namespace '名前空間(e.g. AWS/EC2)' \
--dimensions 'ディメンション(e.g. Name=InstanceId,Value=i-0123456789abcdef)' \
--metric-name 'メトリック名(e.g. CPUUtilization)' \
--comparison-operator '評価条件(e.g. GreaterThanOrEqualToThreshold(>=))' \
--threshold '閾値(e.g. 90)' \
--datapoints-to-alarm '評価条件で閾値を越えたデータポイント数' \
--evaluation-periods '評価対象のデータポイント数. 時間的には evaluation-periods * period 秒' \
--treat-missing-data '欠陥データの処理' \
--period 'データポイントの集計期間(e.g. 300(5min)). evaluation-periods が 2 で period が 300 なら 2 * 300 = 600 秒(10分)間' \
--statistic '統計(e.g. Average)' \
--alarm-actions 'アラーム時のアクション先ARN' \
--ok-actions 'OKに戻ったときのアクション先ARN' \
--insufficient-data-actions 'データ不足時のアクション先ARN'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment