shimgo
3/5/2018 - 2:49 AM

AWS CLIでインスタンスのメトリクスを取得

aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name NetworkIn  --period 600 \
--statistics Maximum --dimensions Name=InstanceId,Value=i-1234567890abcdef0 \
--start-time 2016-10-18T23:18:00 --end-time 2016-10-19T23:58:00

2016/10/18 23:18:00から23:58:00まで10分間隔(--period 600)でNetworkInを取得

インスタンスIDは下記URLから見れる
https://ap-northeast-1.console.aws.amazon.com/ec2/v2/home?region=ap-northeast-1#Instances:sort=instanceId

get-metric-statisticsコマンドのリファレンス

https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/get-metric-statistics.html