https://docs.aws.amazon.com/ja_jp/res/latest/ug/sso-idc.html
https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html
前提として、AWS Organizationの設定、IAM Identity Centerからユーザー作成をしている状態になっていること。
- AWS Organizationを設定する
- IAM Identity Centerでユーザー作成
- グループは適当に、AWSアカウントの割り振りはAWS Organizationの各アカウントを指定
- 許可設定は一旦AdministratorAccessで
- AWS access portal URLをメモる
- あとはTerraformでSSOログインするだけ
- aws configの設定
- ~/.aws/config
1 2 3 4 5 6 7 |
[profile hoge] sso_start_url = https://xxxx.awsapps.com/start sso_region = ap-northeast-1 sso_account_id = xxxxxxxxxxx sso_role_name = AdministratorAccess region = ap-northeast-1 output = json |
- sso ログイン
1 2 3 4 5 6 7 8 9 10 |
$ aws sso login --profile hoge Attempting to automatically open the SSO authorization page in your default browser. If the browser does not open or you wish to use a different device to authorize this request, open the following URL: https://xxxx.awsapps.com/start/#/device Then enter the code: xxxxx Successfully logged into Start URL: https://xxxxxx.awsapps.com/start |
- terraform実行
1 2 |
$ export AWS_PROFILE="hoge" $ terraform plan |
aws configure sso
で対話形式で実行するよりは、.aws/configを先に作成しておくと楽。IAM Identity CenterのTerraform化はまた後ほど。
Was this helpful?
0 / 0
1989年生まれのFindy/SRE。ホスティングから大規模なアドテクなどのインフラエンジニアとして携わる。現在はサービスの信頼性向上、DevOps、可用性、レイテンシ、パフォーマンス、モニタリング、オブザーバビリティ、緊急対応、AWSでのインフラ構築、Docker開発環境の提供、IaC、新技術の検証、リファクタリング、セキュリティ強化、分析基盤の運用などを担当している。
個人事業主では数社サーバー保守とベンチャー企業のインフラコンサルティングを行うほか、TechBullを創業し、未経験者向けにSREのコーチングやコミュニティ運営、LT大会の開催、 会員管理システム「Members」の開発をリードしている。さらに、エンジニア向けYouTubeメディア「TECH WORLD」ではSRE関連の動画に出演し、過去には脆弱性スキャナ「Vuls」のOSS活動にも貢献。