Skip to content

Configure AWS Credentials

This guide explains how to set up and use AWS IAM Identity Center (formerly AWS SSO) for accessing AWS services via the command line. It's recommended to use IAM Identity Center credentials (SSO-based login) rather than static access keys. SSO provides a more secure, manageable, and centralized way to control access without needing long-term credentials.

Configure AWS CLI for SSO

  • Open your terminal and run the command:
aws configure sso

This step connects your local CLI session with your AWS Identity Center account, enabling secure temporary credentials to access AWS resources.

Set AWS CLI Profile

  • Choose the output region for your workloads (e.g., eu-west-3 for Paris).
  • Optionally choose an output format:
  • json, table, or text — or leave it blank for the default.
  • Set a recognizable profile name, for example: embark-aws.

This named profile allows you to reuse the configuration easily in scripts and tools without re-entering credentials.

Re-authenticate if Session Expires

If your session expires (which happens periodically for security), you can re-authenticate using:

aws sso login --profile <profileName>

This command refreshes your session quickly without reconfiguring anything.

Set Profile for CLI Tools

To ensure eksctl, kubectl, and other AWS CLI commands run with the correct credentials, set the profile environment variable:

export AWS_PROFILE=<profileName>

For convenience, you can add this line to your .shellrc, .zshrc, or equivalent shell profile file to apply it automatically in future sessions.

Validate AWS Identity

To verify that your credentials are active and correct, run:

aws sts get-caller-identity --profile $AWS_PROFILE

This command outputs your AWS Account ID, User ARN, and Identity Type, confirming a successful connection.