Skip to main content

Easy login to AWS through the command-line.

The project assumes you have:

  1. An IAM account and credentials present in your environment (e.g. ~/.aws/credentials)
  2. Permissions for the IAM account to assume a given role
  3. The name of the role you want to assume

With the above in place you can get temporary credentials and a web UI login link, granting you all of the powers of the assumed role by running:

$ awsrole MyRole
# Export following vars in your shell for API/CLI access:
    export AWS_ACCESS_KEY_ID=ASI...
    export AWS_SECRET_ACCESS_KEY=10q2I...
    export AWS_SESSION_TOKEN=Fwo......

## Login URL: https://signin.aws.amazon.com/federation?Action=login......

Clicking on/opening the URL in the browser will land you in a preauthenticated session. Copy/pasting the export commands in your shell would enable CLI utilities from using the role's credentials.

The temporary credentials would be valid for up to 12h (max and default value)

Installation

pip install awsrole

Help

$ awsrole --help
usage: awsrole [-h] [-a ACCOUNT] [-t TIME] role

Generate temporary credentials and Login URL for a given AWS role.

positional arguments:
  role                  Role to assume

optional arguments:
  -h, --help            show this help message and exit
  -a ACCOUNT, --account ACCOUNT
                        Specify an account ID, instead of auto-discovering it
  -t TIME, --time TIME  Temp credentials validity in seconds (default: 43200)

Metadata

Release files for awsrole 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for awsrole 0.0.2
File Size Uploaded
awsrole-0.0.2.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for awsrole 0.0.2
File Interpreter ABI Platform
awsrole-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / awsrole-0.0.2.tar.gz

Download URL awsrole-0.0.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5dde52245c81b9d735e72fc48bf0e3ceef2a2fcf056f1913f3a4a106729f7c81
BLAKE2b-256 checksum
How to use checksums
e18f1bee504a04255caa8e069516f8fef46b7a18381328f8fb153df7de5213cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / awsrole-0.0.2-py3-none-any.whl

Download URL awsrole-0.0.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc85278068a8f7d0a7867edbd0d0bb7d1915da659b1f84f8ebba757925763d03
BLAKE2b-256 checksum
How to use checksums
645b742da2b1f7b87aea42a74fb9df0affb30c78b3444f3edabf83ecbc858b82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page