Manual credential refresh

Configuring the AWS CLI - Manual credential refresh

ℹ️ Information: In this section, we will guide you on how to manually configure the AWS CLI to authenticate users with AWS IAM Identity Center. With this method, you must manually refresh the temporary credentials when they expire.

Prerequisites

  1. Install the latest version of the AWS CLI. For more information, see Install or update to the latest version of the AWS CLI.
  2. You must have SSO authentication access in IAM Identity Center.

Manual configuration process

  1. Log in to the AWS Access Portal using the sign-in URL provided for your organization.
  2. In the Accounts tab or by selecting the AWS account icon, identify the AWS account you want to access.
  3. Expand the account to display the available IAM roles (e.g., AdministratorAccess, readOnly).
  4. Next to the desired IAM role, select Access keys to retrieve temporary credentials.

ℹ️ Information: The AWS Access Portal is the centralized interface for managing access to all AWS accounts in your organization through IAM Identity Center.

SSO Access Portal

Using temporary credentials

In the Get credentials dialog box, you have three options for using the credentials:

Option 1: Set AWS environment variables

  • Choose your operating system (MacOS and Linux, Windows, or PowerShell)
  • Copy the provided commands to the clipboard
  • Paste and execute the commands in the terminal to set the environment variables
  • These variables will override all existing credential settings in the current terminal session

💡 Pro Tip: Use this option when you need to quickly switch between different roles in the same working session.

Option 2: Add a profile to the AWS credentials file

  • Copy the provided commands
  • Paste them into the ~/.aws/credentials file to create a new named profile
  • Use this profile with the --profile option in the AWS CLI command
  • Example: aws s3 ls --profile sso-admin-profile

🔒 Security Note: Named profiles allow you to maintain multiple sets of credentials simultaneously and minimize the risk of using the wrong permissions when performing AWS CLI operations.

Option 3: Use individual values in an AWS service client

  • Copy the individual credential values (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN)
  • Integrate these values into your application code when using the AWS SDK

SSO Credentials

⚠️ Warning: Temporary credentials have a limited lifespan, typically 1 hour. When they expire, you need to repeat the process to retrieve new credentials. Temporary credentials should not be stored in long-term configuration files or version control systems.