Movatterモバイル変換


[0]ホーム

URL:


IAM Identity Center credential provider - AWS SDKs and Tools
DocumentationReference Guide
PrerequisitesSSO token provider configurationLegacy non-refreshable configurationIAM Identity Center credential provider settingsSupport by AWS SDKs and tools

IAM Identity Center credential provider

This authentication mechanism uses AWS IAM Identity Center to get single sign-on (SSO) access to AWS services for your code.

After you enable IAM Identity Center, you define a profile for its settings in your shared AWSconfig file. This profile is used to connect to the IAM Identity Center access portal. When a user successfully authenticates with IAM Identity Center, the portal returns short-term credentials for the IAM role associated with that user. To learn how the SDK gets temporary credentials from the configuration and uses them for AWS service requests, seeHow IAM Identity Center authentication is resolved for AWS SDKs and tools.

There are two ways to configure IAM Identity Center through theconfig file:

  • (Recommended) SSO token provider configuration – Extended session durations. Includes support for custom session durations.

  • Legacy non-refreshable configuration – Uses a fixed, eight-hour session.

In both configurations, you need to sign in again when your session expires.

The following two guides contain additional information about IAM Identity Center:

For a deep dive on how the SDKs and tools use and refresh credentials using this configuration, seeHow IAM Identity Center authentication is resolved for AWS SDKs and tools.

Prerequisites

You must first enable IAM Identity Center. For details about enabling IAM Identity Center authentication, seeEnabling AWS IAM Identity Center in theAWS IAM Identity Center User Guide.

SSO token provider configuration

When you use the SSO token provider configuration, your AWS SDK or tool automatically refreshes your session up to your extended session period. For more information on session duration and maximum duration, seeConfigure the session duration of the AWS access portal and IAM Identity Center integrated applications in theAWS IAM Identity Center User Guide.

Thesso-session section of theconfig file is used to group configuration variables for acquiring SSO access tokens, which can then be used to acquire AWS credentials. For more details on this section within aconfig file, seeFormat of the config file.

The following sharedconfig file example configures the SDK or tool using adev profile to request IAM Identity Center credentials.

[profiledev]sso_session =my-ssosso_account_id =111122223333sso_role_name =SampleRole[sso-sessionmy-sso]sso_region =us-east-1sso_start_url =https://my-sso-portal.awsapps.com/startsso_registration_scopes =sso:account:access

The previous examples shows that you define ansso-session section and associate it to a profile. Typically,sso_account_id andsso_role_name must be set in theprofile section so that the SDK can request AWS credentials.sso_region,sso_start_url, andsso_registration_scopes must be set within thesso-session section.

sso_account_id andsso_role_name aren't required for all scenarios of SSO token configuration. If your application only uses AWS services that support bearer authentication, then traditional AWS credentials are not needed. Bearer authentication is an HTTP authentication scheme that uses security tokens called bearer tokens. In this scenario,sso_account_id andsso_role_name aren't required. See the individual AWS service guide to determine if the service supports bearer token authorization.

Registration scopes are configured as part of ansso-session. Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account. The previous example setssso_registration_scopes to provide necessary access for listing accounts and roles.

The following example shows how you can reuse the samesso-session configuration across multiple profiles.

[profiledev]sso_session =my-ssosso_account_id =111122223333sso_role_name =SampleRole[profile prod]sso_session =my-ssosso_account_id =111122223333sso_role_name =SampleRole2[sso-sessionmy-sso]sso_region =us-east-1sso_start_url =https://my-sso-portal.awsapps.com/startsso_registration_scopes =sso:account:access

The authentication token is cached to disk under the~/.aws/sso/cache directory with a file name based on the session name.

Legacy non-refreshable configuration

Automated token refresh isn't supported using the legacy non-refreshable configuration. We recommend using theSSO token provider configuration instead.

To use the legacy non-refreshable configuration, you must specify the following settings within your profile:

  • sso_start_url

  • sso_region

  • sso_account_id

  • sso_role_name

You specify the user portal for a profile with thesso_start_url andsso_region settings. You specify permissions with thesso_account_id andsso_role_name settings.

The following example sets the four required values in theconfig file.

[profilemy-sso-profile]sso_start_url =https://my-sso-portal.awsapps.com/startsso_region =us-west-2sso_account_id =111122223333sso_role_name =SSOReadOnlyRole

The authentication token is cached to disk under the~/.aws/sso/cache directory with a file name based on thesso_start_url.

IAM Identity Center credential provider settings

Configure this functionality by using the following:

sso_start_url - shared AWSconfig file setting

The URL that points to your organization's IAM Identity Center issuer URL or access portal URL. For more information, seeUsing the AWS access portal in theAWS IAM Identity Center User Guide.

To find this value, open theIAM Identity Center console, view theDashboard, findAWS access portal URL.

  • Alternatively, starting with version2.22.0 of the AWS CLI, you can instead use the value forAWS Issuer URL.

sso_region - shared AWSconfig file setting

The AWS Region that contains your IAM Identity Center portal host; that is, the Region you selected before enabling IAM Identity Center. This is independent from your default AWS Region, and can be different.

For a complete list of the AWS Regions and their codes, seeRegional Endpoints in theAmazon Web Services General Reference. To find this value, open theIAM Identity Center console, view theDashboard, and findRegion.

sso_account_id - shared AWSconfig file setting

The numeric ID of the AWS account that was added through the AWS Organizations service to use for authentication.

To see the list of available accounts, go to theIAM Identity Center console and open theAWS accounts page. You can also see the list of available accounts using theListAccounts API method in theAWS IAM Identity Center Portal API Reference. For example, you can call the AWS CLI methodlist-accounts.

sso_role_name - shared AWSconfig file setting

The name of a permission set provisioned as an IAM role that defines the user's resulting permissions. The role must exist in the AWS account specified bysso_account_id. Use the role name, not the role Amazon Resource Name (ARN).

Permission sets have IAM policies and custom permissions policies attached to them and define the level of access that users have to their assigned AWS accounts.

To see the list of available permission sets per AWS account, go to theIAM Identity Center console and open theAWS accounts page. Choose the correct permission set name listed in the AWS accounts table. You can also see the list of available permission sets using theListAccountRoles API method in theAWS IAM Identity Center Portal API Reference. For example, you can call the AWS CLI methodlist-account-roles.

sso_registration_scopes - shared AWSconfig file setting

A comma-delimited list of valid scope strings to be authorized for thesso-session. An application can request one or more scopes, and the access token issued to the application is limited to the scopes granted. A minimum scope ofsso:account:access must be granted to get a refresh token back from the IAM Identity Center service. For the list of available access scope options, seeAccess scopes in theAWS IAM Identity Center User Guide.

These scopes define the permissions requested to be authorized for the registered OIDC client and access tokens retrieved by the client. Scopes authorize access to IAM Identity Center bearer token authorized endpoints.

This setting doesn't apply to the legacy non-refreshable configuration. Tokens issued using the legacy configuration are limited to scopesso:account:access implicitly.

Support by AWS SDKs and tools

The following SDKs support the features and settings described in this topic. Any partial exceptions are noted. Any JVM system property settings are supported by the AWS SDK for Java and the AWS SDK for Kotlin only.

SDKSupportedNotes or more information
AWS CLI v2Yes
SDK for C++Yes
SDK for Go V2 (1.x)Yes
SDK for Go 1.x (V1)YesTo use sharedconfig file settings, you must turn on loading from the config file; seeSessions.
SDK for Java 2.xYesConfiguration values also supported incredentials file.
SDK for Java 1.xNo
SDK for JavaScript 3.xYes
SDK for JavaScript 2.xYes
SDK for KotlinYes
SDK for .NET 4.xYes
SDK for .NET 3.xYes
SDK for PHP 3.xYes
SDK for Python (Boto3)Yes
SDK for Ruby 3.xYes
SDK for RustPartialLegacy non-refreshable configuration only.
SDK for SwiftYes
Tools for PowerShell V5Yes
Tools for PowerShell V4Yes
Container provider
IMDS provider

[8]
ページ先頭

©2009-2025 Movatter.jp