Skip to main content

Generate temporary login link and envvars for AWS IAM Role

Project description

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)

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

awsrole-0.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

awsrole-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file awsrole-0.0.2.tar.gz.

File metadata

  • Download URL: awsrole-0.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for awsrole-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5dde52245c81b9d735e72fc48bf0e3ceef2a2fcf056f1913f3a4a106729f7c81
MD5 b917a7f87cc696533861ede482e5cf26
BLAKE2b-256 e18f1bee504a04255caa8e069516f8fef46b7a18381328f8fb153df7de5213cc

See more details on using hashes here.

File details

Details for the file awsrole-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: awsrole-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for awsrole-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc85278068a8f7d0a7867edbd0d0bb7d1915da659b1f84f8ebba757925763d03
MD5 6038223e9b3646d20a284e9cc447d4d6
BLAKE2b-256 645b742da2b1f7b87aea42a74fb9df0affb30c78b3444f3edabf83ecbc858b82

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