【参考】
https://blog.katsubemakito.net/aws/cli-multi-account
例によってまんまです。すみません。
【メモ】
a)aws configureでプロファイル名を指定して追加する
aws configure --profile hogehoge AWS Access Key ID [None]: <追加のIAMのアクセスキー> AWS Secret Access Key [None]: <追加のIAMのシークレットアクセスキー> Default region name [None]: ap-northeast-1 Default output format [None]: json
b)直接追加する
~/.aws/credentials プロファイルにproject1追記する
[default] aws_access_key_id = <利用中のdefaultは消さないこと> aws_secret_access_key = <同上> [hogehoge] aws_access_key_id = <追加のIAMのアクセスキー> aws_secret_access_key = <追加のIAMのシークレットアクセスキー>
~/.aws/config
[profile (プロファイル名)]のように記載する
[default] region = ap-northeast-1 output = json [profile hogehoge] region = ap-northeast-1 output = json
■つかいかた
a)--profileで都度指定
aws s3 ls --profile hogehoge
b)環境変数で指定
export AWS_PROFILE=hogehoge
(念のため確認)aws configure list
など