0
1

More than 1 year has passed since last update.

AWS CLI の使い方メモ(windows)

Posted at

インストール方法

  1. AWS 公式から AWS CLI MSI インストーラ をダウンロード
  2. ダウンロードしたインストーラを実行して端末にインストールする
  3. インストール後にコマンドプロンプトで以下を実行し、インストールできたか確認する
$ aws --version
aws-cli/2.8.10 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

設定

以下の方法でユーザ情報を設定する

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

使い方

  • 指定したインスタンスIDで取得できるメトリクスの一覧を表示
$ aws cloudwatch list-metrics --namespace AWS/EC2 --dimensions Name=InstanceId,Value=i-xxxxxxxxxxxxxxxxx 
  • CPUUtilization を指定した期間(+9時間)、5分間の粒度、指定したインスタンスID、平均値をタブ区切りでファイルに出力する方法
$ aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --start-time yyyy-mm-ddTHH:MM:SS+09 --end-time yyyy-mm-ddTHH:MM:SS+09 --period 300 --dimensions Name=InstanceId,Value=i-xxxxxxxxxxxxxxxxx --statistics Average --output table > log.txt

参考

0
1
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
0
1