LoginSignup
2
2

More than 5 years have passed since last update.

saml2awsのCLIを持ち複数のAWS Profileを自在に操る高貴なる俺のためのtips

Posted at

光速の異名を持ちkuraudoを自在に操る高貴なる俺です。

初老丸 Advent Calendar 2018のエントリです。

saml2awsというCLIがあります。
複数のIdPアカウントを使い、複数のAWSアカウントを制御するためのtipsです。

configure

--idp-accountオプションを指定し、そのIdPアカウントに関連付けるProfileを設定します。
configureの結果は~/.saml2awsに記録されます。

$ saml2aws configure --idp-account=bbb
? Please choose a provider: Okta
? AWS Profile (saml) bbb
? URL https://aaaaaaaaaaaaaaaaaaaaaaaaa
? Username kishigami

? Password *******************************************
? Confirm *******************************************

account {
  URL: https://aaaaaaaaaaaaaaaaaaaaaaaaa
  Username: kishigami
  Provider: Okta
  MFA: Auto
  SkipVerify: false
  AmazonWebservicesURN: urn:amazon:webservices
  SessionDuration: 3600
  Profile: bbb
}
$ cat ~/.saml2aws
[bbb]
url                  = https://aaaaaaaaaaaaaaaaaaaaaaaaa
username             = kishigami
provider             = Okta
mfa                  = Auto
skip_verify          = false
timeout              = 0
aws_urn              = urn:amazon:webservices
aws_session_duration = 3600
aws_profile          = bbb

loginとcheck

  • 一時クレデンシャルを受け取ります

IdP aaaから受け取ったCredentialsは~/.aws/credentialsのProfile bbbとしてセットされます。

saml2aws login --idp-account=bbb --profile=bbb
  • Profile bbbのS3バケットをlist
aws s3 ls --profile bbb --region ap-northeast-1

おわり

2
2
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
2
2