aws_role_switcher
This is a CLI application makes it easier to switch roles using auto completion from parsing your aws config/credential file and setting "AWS_SECRET_ACCESS_KEY", "AWS_ACCESS_KEY_ID", "AWS_SESSION_TOKEN", "AWS_SECURITY_TOKEN" environment variables if present.
This script does not support MFA roles, and designed to help cycle through profiles set manually, or as output from an SSO script like: https://github.com/Nike-Inc/gimme-aws-creds
Installation
python3 -m pip install -U aws_role_switcher
In order to work properly this script must be sourced, add the following to your .profile or .bashrc( you can adjust the alias name to whatever you want)
alias ars='source aws-role-switcher.sh'
Note: You can run this from the command line using . aws-role-switcher.sh or source aws-role-switcher.sh.
Configuration
You can set the following environmental variables:
AWS_PROFILE_SWITCHER_PATH - Override the default credential/config file location from $HOME/.aws/credentials
I would recommend adding to your ~/.profile or ~/.bash_profile
Example Usage
ars to start prompt. TAB or start typing to start auto completion list. TAB or use arrows to cycle through list, and enter to select.
Pass profile and region positional variables (Optional)
using a format of <script> <profile_arg> <region_arg> the utility will start the prompt process with the passed in args
i.e
ars admin uswest2
Example config file:
[default]
aws_access_key_id = REDACTED
aws_secret_access_key = redacted
aws_session_token = default
aws_security_token = default
[testing-administrator]
aws_access_key_id = REDACTED
aws_secret_access_key = redacted
aws_session_token = testing
aws_security_token = testing
[staging-administrator]
aws_access_key_id = REDACTED
aws_secret_access_key = redacted
aws_session_token = staging
aws_security_token = staging
[production-administrator]
aws_access_key_id = REDACTED
aws_secret_access_key = redacted
aws_session_token = production
aws_security_token = production
Example Usage:
Updated Example (1.5.0):
Development
Bug Reports & Feature Requests
Please use the submit a issue to report any bugs or file feature requests.
Developing
If you are interested in being a contributor and want to get involved in developing this CLI application feel free to reach out
In general, PRs are welcome. We follow the typical trunk based development Git workflow.
- Branch the repo
- Clone the project to your own machine
- Commit changes to your branch
- Push your work back up to your branch
- Submit a Merge/Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!
Metadata
Release files for aws-role-switcher 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aws-role-switcher-1.5.0.tar.gz | 4.9 kB | Without provenance | Details for aws-role-switcher-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aws_role_switcher-1.5.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for aws_role_switcher-1.5.0-py2.py3-none-any.whl |
Total release size: 10.6 kB
Release files / aws-role-switcher-1.5.0.tar.gz
| Download URL | aws-role-switcher-1.5.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e030f21a2f2fd154111602d7bb60903481fa13d764d582f21bfc17b81d0126e
|
|
BLAKE2b-256 checksum How to use checksums |
480fcabe88902a2b110f2ceb5752ee559314041eb8e868bf0d9df73266d15d04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / aws_role_switcher-1.5.0-py2.py3-none-any.whl
| Download URL | aws_role_switcher-1.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
58c72624b1b45d0b9c7e4429f00e1d11ab4f3cd9e47f12d2240d28a9da3c984c
|
|
BLAKE2b-256 checksum How to use checksums |
977a9aa36007ed878c141058ee8bd3b495265a17c4cda6f016840ff2b271e10e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Security for aws-role-switcher 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.