1
1

More than 3 years have passed since last update.

AWS CLIのコンフィグ設定

Posted at

AWS CLIのコンフィグ設定

スイッチロールの権限をAWS CLIで使う方法
以下記事の補足記事

AWS CLIのコンフィグ設定

スイッチロールに対応するには~/.aws/configにprofileを設定

$ vi ~/.aws/credentials
[default]
aws_access_key_id = xxx
aws_secret_access_key = xxx

$ vi ~/.aws/config
[default]
region = ap-northeast-1
output = json

[profile toyscreation-sandbox]
role_arn = arn:aws:iam::689371460795:role/toyscreation-sandbox
source_profile = default

確認

profileを指定することで、スイッチ先のロールで操作が可能

$ aws s3 ls
An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied
$ aws s3 ls --profile toyscreation-sandbox
2021-05-16 02:50:54 toyscreation-sandbox
1
1
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
1
1