LoginSignup
9
8

More than 3 years have passed since last update.

awscliメモ

Last updated at Posted at 2015-05-19

MACからの操作。

  • awscliはpythonなので入れる

    $ brew install python
    
  • pipでインストール

    $ pip install awscli
    
  • マネジメントコンソール画面からIAMユーザの作成
    参考:http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/Using_SettingUpUser.html

  • CSVのダウンロードはここでしかできないらしいので必ずしておく。

  • IAMユーザを作成したら「ポリシーのアタッチ」選択し「AmazonEC2FullAccess」あたりの権限を選択する。ほかのでもよい。

  • ダウンロードしたCSVをもとにIAMユーザ設定をローカルにしていく。

    $ aws configure
    AWS Access Key ID [None]: AKI***********HRQ
    AWS Secret Access Key [None]: ALuPJ**********************cNs41
    Default region name [None]: ap-northeast-1
    Default output format [None]: json
    
    $ ls -la ~/.aws/
    
    $ cat ~/.aws/config
    [default]
    output = json
    region = ap-northeast-1
    
    $ cat ~/.aws/credentials
    [default]
    aws_access_key_id = AKI***********HRQ
    aws_secret_access_key = ALuPJ**********************cNs41
    

ec2インスタンス一覧を出力する

    $ aws ec2 describe-instances

※「ポリシーのアタッチ」をしていないと以下のように権限がないと怒られる。

    $ aws ec2 describe-instances
A client error (UnauthorizedOperation) occurred when calling the DescribeInstances operation: You are not authorized to perform this operation.
9
8
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
9
8