Prerequisites 前提条件
IAM Identity Center 管理アカウントを作成する
AWS CLI バージョン 2 を使用するための前提条件 - AWS Command Line Interface
AWS Command Line Interface バージョン 2 をシステムにインストールする前に、AWS アカウントと IAM 認証情報が必要です。
Installation インストール
AWS CLI の最新バージョンのインストールまたは更新 - AWS Command Line Interface
システムに AWS CLI をインストールまたは更新する手順。
Configuration 設定
$ aws configure sso
SSO session name (Recommended): my-sso
SSO start URL [None]: https://my-sso-portal.awsapps.com/start
SSO region [None]: REGION
SSO registration scopes [sso:account:access]:
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:
URL
The only AWS account available to you is: ACCOUNT_ID
Using the account ID ACCOUNT_ID
The only role available to you is: ROLE
Using the role name "ROLE"
Default client Region [None]: REGION
CLI default output format (json if not specified) [None]: FORMAT
Profile name [PROFILE]:
To use this profile, specify the profile name using --profile, as shown:
aws sts get-caller-identity --profile PROFILE
AWS CLI を使用した IAM アイデンティティセンター認証の設定 - AWS Command Line Interface
このセクションでは、認証情報を取得して AWS CLI コマンドを実行するために、IAM アイデンティティセンターを使用してユーザーを認証するように AWS CLI を設定する方法について説明します。
Sign in サインイン
$ aws sso login --profile PROFILE
設定時にプロファイル名を “default” と指定すると、–profileオプション省略時はそのプロファイルをデフォルトとして使用します。
Profile name [PROFILE]: default
$ aws sso login
Sign out サインアウト
$ aws sso logout
Reference 参考
AWS CLI の開始方法 - AWS Command Line Interface
AWS CLI のインストール方法に関する手順と AWS CLI コマンドの実行に必要な前提条件を参照して、AWS CLI バージョン 2 の使用を開始します。
Configuration and credential file settings in the AWS CLI - AWS Command Line Interface
頻繁に利用される構成設定および認証情報を指定された profiles に分割することができます。