Skip to main content

Simple CLI for AWS SSO credential management across multiple accounts and roles

Project description

aws-assume

Simple CLI for AWS SSO credential management across multiple accounts and roles.

Installation

pip install aws-assume-cli

Usage

# Eval into your shell (most common usage)
eval $(aws-assume my-profile)

# List available profiles
aws-assume --list

# Output as JSON
aws-assume my-profile --json

# Write to a Docker .env file
aws-assume my-profile --env-file .env

# Write to ~/.aws/credentials
aws-assume my-profile --credentials

# Write credentials under a specific profile name
aws-assume my-profile --credentials --credentials-profile temp-dev

# Set session duration (for role assumption)
aws-assume my-profile --duration 3600

# Skip automatic SSO login prompt
aws-assume my-profile --no-auto-login

How it works

aws-assume reads your ~/.aws/config and supports three profile types:

SSO profiles — logs you in via aws sso login if the session is expired, then fetches temporary credentials.

[profile my-sso]
sso_start_url = https://my-org.awsapps.com/start
sso_region = us-east-1
sso_account_id = 123456789012
sso_role_name = AdministratorAccess
region = us-east-1

Role assumption profiles — assumes a role using another profile as the source.

[profile prod-admin]
role_arn = arn:aws:iam::999999999999:role/AdminRole
source_profile = my-sso
region = us-east-1

SSO + role chaining — the source profile itself uses SSO. aws-assume handles the chain automatically.

Output modes

Flag Output Use case
(default) export VAR=... eval $(aws-assume profile) in shell
--json JSON object Scripting, piping
--env-file PATH Docker .env format docker run --env-file .env ...
--credentials ~/.aws/credentials SDK / tool compatibility

Development

git clone https://github.com/brianjbeach/aws-assume
cd aws-assume
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_assume_cli-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_assume_cli-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file aws_assume_cli-0.1.0.tar.gz.

File metadata

  • Download URL: aws_assume_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aws_assume_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f56c4ee76a669015d8b86efc9d238c0171ab8bfe8952a4001ca98970e23a2584
MD5 ef82dce9656abf123d20038ccb57bd5a
BLAKE2b-256 1315fe67f696ec33af8b99b2b6a62ebc359411133f9946c070bb83da79a8a80b

See more details on using hashes here.

File details

Details for the file aws_assume_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aws_assume_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for aws_assume_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b29b7da196e4b40af795cf031a8be3099164f93daf66340f3715e004ce36996
MD5 251e7d02d2a2f8145cbd83f7900583b2
BLAKE2b-256 b80f3f7e834afc28f6cc1c1ddd51e5c6e5a0150aa286eea9d13ca0d740dc4fb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page