LoginSignup
2
2

More than 5 years have passed since last update.

AWS CLIにてCloudWatchにログをあげる

Last updated at Posted at 2014-09-08

AWSのリソース以外のログを、カスタムメトリクスとしてCloudWatchにあげてみる。

AWS CLIのインストール

Ubuntu

sudo apt-get install pip
sudo pip install awscli

コマンド使用方法

初期設定

"aws configure"
上記のコマンドで、環境変数を設定

aws configure
AWS Access Key ID [None]: {アクセスキー}
AWS Secret Access Key [None]: {シークレットアクセスキー}
Default region name [None]: {リージョン(ex: ap-northeast-1)}
Default output format [None]: {ex: json}

実際にPOSTさせるコマンド

日付のフォーマットは、"yyyy-MM-dd'T'hh:flag_mm:ss'Z'"
linuxのdateコマンドを使うと、date -u +"%Y-%m-%dT%H:%m:%SZ"

aws cloudwatch put-metric-data --metric-name {メトリック名} --namespace {グラフ名} --value {値} --timestamp {日付}

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2