Help us understand the problem. What is going on with this article?

AWS CLIで複数アカウント(認証情報)を簡単に切り替える方法

はじめに

以下の状況を踏まえ、備忘録を兼ねてアカウント切替え方法をまとめます。

  • 異なるアカウントで操作する機会が増えた
  • aws configureで認証情報を毎回入力して切替えるのが煩わしい

Profileを作成する

コマンド
aws configure --profile [profile]

↓↓↓ 作成サンプル
image.png

↓↓↓ 作成先は以下の2ファイル
・C:\Users[ユーザー名].aws\credentials

credentials
[test]
aws_access_key_id = test
aws_secret_access_key = test

・C:\Users[ユーザー名].aws\config

config
[profile test]
output = test
region = test

Profileを切り替える

AWS_DEFAULT_PROFILE
set AWS_DEFAULT_PROFILE=[Proflie]

↓↓↓ 実行サンプル
image.png

コマンド補足

コマンド
`認証状況`
aws configure list
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした