IAM Identity Center authentication - Amazon SDKs and Tools
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

IAM Identity Center authentication

Amazon IAM Identity Center is the recommended method of providing Amazon credentials when developing on a non-Amazon compute service. For example, this would be something like your local development environment. If you are developing on an Amazon resource, such as Amazon Elastic Compute Cloud (Amazon EC2) or Amazon Cloud9, we recommend getting credentials from that service instead.

In this tutorial, you establish IAM Identity Center access and will configure it for your SDK or tool by using the Amazon access portal and the Amazon CLI.

  • The Amazon access portal is the web location where you manually sign in to the IAM Identity Center. The format of the URL is d-xxxxxxxxxx.awsapps.com/startor your_subdomain.awsapps.com/start. When signed in to the Amazon access portal, you can view Amazon Web Services accounts and roles that have been configured for that user. This procedure uses the Amazon access portal to get configuration values you need for the SDK/tool authentication process.

  • The Amazon CLI is used to configure your SDK or tool to use IAM Identity Center authentication for API calls made by your code. This one-time process updates your shared Amazon config file, that is then used by your SDK or tool when you run your code.

Configure programmatic access using IAM Identity Center

Step 1: Establish access and select appropriate permission set

If you haven't enabled IAM Identity Center yet, see Enabling IAM Identity Center in the Amazon IAM Identity Center User Guide.

Choose one of the following methods to access your Amazon credentials.

  1. Add a user and add administrative permissions by following the Configure user access with the default IAM Identity Center directory procedure in the Amazon IAM Identity Center User Guide.

  2. The AdministratorAccess permission set should not be used for regular development. Instead, we recommend using the predefined PowerUserAccess permission set, unless your employer has created a custom permission set for this purpose.

    Follow the same Configure user access with the default IAM Identity Center directory procedure again, but this time:

    • Instead of creating the Admin team group, create a Dev team group, and substitute this thereafter in the instructions.

    • You can use the existing user, but the user must be added to the new Dev team group.

    • Instead of creating the AdministratorAccess permission set, create a PowerUserAccess permission set, and substitute this thereafter in the instructions.

    When you are done, you should have the following:

    • A Dev team group.

    • An attached PowerUserAccess permission set to the Dev team group.

    • Your user added to the Dev team group.

  3. Exit the portal and sign in again to see your Amazon Web Services accounts and options for Administrator or PowerUserAccess. Select PowerUserAccess when working with your tool/SDK.

Sign in to Amazon through your identity provider’s portal. If your Cloud Administrator has granted you PowerUserAccess (developer) permissions, you see the Amazon Web Services accounts that you have access to and your permission set. Next to the name of your permission set, you see options to access the accounts manually or programmatically using that permission set.

Custom implementations might result in different experiences, such as different permission set names. If you're not sure which permission set to use, contact your IT team for help.

Sign in to Amazon through the Amazon access portal. If your Cloud Administrator has granted you PowerUserAccess (developer) permissions, you see the Amazon Web Services accounts that you have access to and your permission set. Next to the name of your permission set, you see options to access the accounts manually or programmatically using that permission set.

Contact your IT team for help.

Step 2: Configure SDKs and tools to use IAM Identity Center

  1. On your development machine, install the latest Amazon CLI.

    1. See Installing or updating the latest version of the Amazon CLI in the Amazon Command Line Interface User Guide.

    2. (Optional) To verify that the Amazon CLI is working, open a command prompt and run the aws --version command.

  2. Sign in to the Amazon access portal. Your employer may provide this URL or you may get it in an email following Step 1: Establish access. If not, you can find your Amazon access portal URL on the Dashboard of https://console.amazonaws.cn/singlesignon/.

    1. In the Amazon access portal, select the appropriate permission set, then select its Command line or programmatic access link. Use the predefined PowerUserAccess permission set, or whichever permission set you or your employer has created to apply least-privilege permissions for development.

    2. In the Get credentials dialog box, choose either MacOS and Linux or Windows, depending on your operating system.

    3. Choose the IAM Identity Center credentials method to get the SSO Start URL and SSO Region values that you need for the next step.

  3. In the Amazon CLI command prompt, run the aws configure sso command. When prompted, enter the configuration values that you collected in the previous step. For details on this Amazon CLI command, see Configure your profile with the aws configure sso wizard.

    1. For CLI profile name, we recommend entering default when you are getting started. For information about how to set non-default (named) profiles and their associated environment variable, see Profiles.

  4. (Optional) In the Amazon CLI command prompt, confirm the active session identity by running the aws sts get-caller-identity command. The response should show the IAM Identity Center permission set that you configured.

  5. If you are using an Amazon SDK, create an application for your SDK in your development environment.

    1. For some SDKs, additional packages such as SSO and SSOOIDC must be added to your application before you can use IAM Identity Center authentication. For details, see your specific SDK.

    2. If you previously configured access to Amazon, review your shared Amazon credentials file for any Amazon access keys. You must remove any static credentials before the SDK or tool will use the IAM Identity Center credentials because of the Credential provider chain precedence.

For a deep dive into how the SDKs and tools use and refresh credentials using this configuration, see Understand IAM Identity Center authentication.

Depending on your configured session lengths, your access will eventually expire and the SDK or tool will encounter an authentication error. To refresh the access portal session again when needed, use the Amazon CLI to run the aws sso login command.

You can extend both the IAM Identity Center access portal session duration and the permission set session duration. This lengthens the amount of time that you can run code before you need to manually sign in again with the Amazon CLI. For more information, see the following topics in the Amazon IAM Identity Center User Guide:

For details on all IAM Identity Center provider settings for SDKs and tools, see IAM Identity Center credential provider in this guide.