[AWS] スイッチロール先用のprofileの書き方

2020/08/31   #aws 
このエントリーをはてなブックマークに追加

スイッチロール元を moto
スイッチロール先を saki
とする。
IAM で assume role しているものとする。

~/.aws/credentials

moto のアクセスキー/シークレットキーを書いておく。

~/.aws/config

以下のような感じにする。

[profile moto]
region = ap-northeast-1

[profile saki]
region = ap-northeast-1
role_arn = arn:aws:iam::xxxxxxxxxxxx:role/XxxxXxxx
source_profile = moto

saki の profile に role_arn で IAM の arn を指定し、
さらに source_profile でスイッチロール元のプロファイル名を指定する。

参考:
[初心者向け]AWS CLIでMFA必須のスイッチロール先のS3にアクセスしてみた | Developers.IO
AWS CLIでインスタンスプロファイルからのAssumeRoleが簡単になりました | Developers.IO