0
0

More than 3 years have passed since last update.

AWS CLIアカウントのプロファイル切り替え

Last updated at Posted at 2020-04-21

AWS CLIアカウントをプロファイル名つきで登録する

ターミナル
$ aws configure --profile プロファイル名
AWS Access Key ID [None]: 
AWS Secret Access Key [None]: 
Default region name [None]:
Default output format [None]:

登録したプロファイルを確認する

ターミナル
$ aws configure list

登録したプロファイルは以下のファイルに保存されている

~/.aws/config
[default]
region = ap-northeast-1
[profile staging-profile]
region = ap-northeast-1
~/.aws/credentials
[default]
aws_access_key_id = AKIAXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[staging-profile]
aws_access_key_id = AKIAYYYYYYYYYYYYYYYY
aws_secret_access_key = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

プロファイルを指定して実行する

ターミナル
$ aws --profile staging-profile s3 ls

環境変数に設定する

ターミナル
$ export AWS_PROFILE=staging-profile
0
0
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
0