Skip to main content

CLI tool to authenticate AWS IAM users with password + MFA via Console sign-in (no access keys needed)

Project description

awsuser

Python CLI for AWS IAM user authentication with password + MFA. Automates the AWS Console sign-in flow using a headless browser to obtain temporary credentials — no pre-existing access keys needed.

Installation

pip install awsuser
playwright install chromium

Or from source:

pip install -e ".[test]"
playwright install chromium

Note: On macOS and Windows, awsuser uses your installed Google Chrome by default. You only need playwright install chromium if Chrome isn't installed or you want to use the bundled Chromium.

Usage

# Basic usage (prompts for password and MFA code)
awsuser -a 123456789012 -u alice

# Save password to system keyring for next time
awsuser -a 123456789012 -u alice --save

# Output as environment variables
source <(awsuser -a 123456789012 -u alice --output env)

# Custom profile name
awsuser -a 123456789012 -u alice -p myprofile

# With specific region
awsuser -a 123456789012 -u alice --region us-west-2

# Use a specific browser
awsuser -a 123456789012 -u alice --browser firefox

# Debug mode (verbose logging)
awsuser -a 123456789012 -u alice --debug

How It Works

  1. Prompts for your IAM user password (or reads from keyring/USER_PASSWORD env var)
  2. Prompts for your 6-digit MFA TOTP code
  3. Opens a headless browser (Google Chrome on macOS/Windows, Chromium on Linux)
  4. Automates the AWS Console sign-in flow (account + username + password + MFA)
  5. Opens CloudShell and runs aws configure export-credentials
  6. Extracts temporary credentials and writes them to ~/.aws/credentials

Running Tests

./run_tests.sh

Or manually:

python3 -m pytest tests/ --cov=awsuser --cov-report=term-missing --cov-fail-under=80 -v

Documentation

License

MIT

Disclaimer

This tool automates the AWS Console sign-in flow using browser automation. It relies on the Console's UI structure which AWS may change without notice. If the tool stops working after an AWS Console update, please open an issue.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

awsuser-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for awsuser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb33dc6319ffb5bc9f829c5ecad38d506f294a078554d00feb5cc391e2d559af
MD5 64d16da9840d4686bc106af3176fed37
BLAKE2b-256 2482291f1649f0803974e614b10e557590faeb080fa21e7c3d16a0b95b3dd0ac

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