No project description provided
Project description
AWS SSO Credential Helper
AWSの認証を、AWS SSO (IAM Identity Center)を使って組織のユーザーディレクトリと連携されているケースは多いのではないでしょうか。
また、SSOでの認証後、各プロダクト・プロジェクト毎の専用ロールへスイッチロールが必要な場合も多いかと思います。
AWS SSO Credential Helperは、AWS SSOを通した認証と、その後のスイッチロールでの一時認証情報の取得を助けます。
実行時には、必要に応じてブラウザにて認証確認を求められますので、許可して下さい。
AWS SSOの認証tokenはファイルにキャッシュし、有効期間内であれば再利用します。
また、キャッシュはホームディレクトリにファイルとして保存し、Credential Helperを使った複数のプログラムで共有して利用することができます。
Usage
1. Create Instance
credential_helper = CredentialHelper(
start_url="d-xxxxxxxxxx.awsapps.com/start",
region_name="ap-northeast-1"
)
- start_url : AWSアクセスポータルのURL
- region_name : 対象とするIAM Identity Centerのリージョン
2. Get Credentials
credentials = credential_helper.get_swrole_credentials(
sso_account_id="123456789",
sso_role_name="ssoRoleName",
sw_role_arn="arn:aws:iam::123456789012:role/sw-role-name"
)
- sso_account_id : アクセスポータルのあるAWSアカウントID
- sso_role_name : SSOでログインするロール
- sw_role_arn : SSOでログイン後、スイッチロールする先のロールのARN
3. Create boto3 client with credentials
lambda_client = boto3.client(
"lambda",
region_name="ap-northeast-1",
aws_access_key_id=credentials["AccessKeyId"],
aws_secret_access_key=credentials["SecretAccessKey"],
aws_session_token=credentials["SessionToken"],
)
Credentials
{
'AccessKeyId': 'XXXXXXXXXXXXX',
'SecretAccessKey': 'YYYYYYYYY',
'SessionToken': 'ZZZZZZZZZZ',
'Expiration': 有効期限,
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_sso_credential_helper-0.0.1.tar.gz.
File metadata
- Download URL: aws_sso_credential_helper-0.0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6abfa9de5444898762c6ffd731a29d7402ae4788fe7e5f201448d53d843b2d6a
|
|
| MD5 |
38a7a8012a0611a6471b08717044acc6
|
|
| BLAKE2b-256 |
05e7de9e0c9c16baa3339d4b122e2c216ec7361c35cc498a11bcfa516ac71752
|
File details
Details for the file aws_sso_credential_helper-0.0.1-py3-none-any.whl.
File metadata
- Download URL: aws_sso_credential_helper-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51c17d60a8ddf5bf128177ccf37da9d46f04d613f8a384ed0d148f8394792713
|
|
| MD5 |
acaff58394e06bf1c58b6b71205d604f
|
|
| BLAKE2b-256 |
7e102f9f7c97408677c80943d50905d115d05e748604c1b1f2640f890964d065
|