Magic credentials on the AWS CLI home using AWS SSO login
Project description
aws-sso-magic tool cli
This tool update the aws credentials file for the default profile from the aws sso login.
This solution mixed the following repositories:
- aws-sso-util AWS SSO has some rough edges, and aws-sso-util is here to smooth them out, hopefully temporarily until AWS makes it better.
- aws-sso-credentials A simple Python tool to simplify getting short-term credential tokens for CLI/Boto3 operations when using AWS SSO.
Content of the repository
- src - The main folder with the aws_sso_magic folder with the .py files & the requirements.txt.
- docker-build.sh - A docker build tool (Linux/MacOS) to build the docker image locally.
sudo ./docker-build.sh
- pyproject.toml - The metadata file with the dependencies and application information.
- Dockerfile - The docker file with the instructions to build the aws-sso-magic cli.
- eks-login - A script tool to add on the /usr/local/bin (Only for linux/macOS or Windows WSL).
eks-login develop-readonly
Installation
Using pyp installer
- Prerequisites
- Python 3.9 installed.
- AWS CLI v2 installed, please click on the link depending of your OS.
- Installation
-
Follow the pyp aw-sso-magic project instructions to install it.
Note: If you want upgrade it, please run this
pip install aws-sso-magic --upgrade
Using Docker
- Please follow the instructions from the docker hub repository of aws_sso_magic
Configuration Instructions
These steps will create the config files on the paths $HOME/.aws and $HOME/.aws-sso-magic.
- Execute the following command to configure the sso tool:
aws-sso-magic configure
- Type the following information:
- SSO start URL
- SSO Region
- Select the default profile of SSO
- CLI default client Region
- CLI default output format
- CLI profile name. Eg: default
- Enter only the name of the proxy role to use by default. Eg: MyAdminRole or just press Enter
- Optional: In case that you want to set an account alias, you can modify the file on $HOME/.aws-sso-magic/config adding the [AliasAccounts] section with key (account name) and value (alias account) Eg:
making the above configuration, it will now show the aliases in the profile selection menu when aws-sso-magic login command is executed.[AliasAccounts] test1 = dev test2 = qa test3 = staging test4 = prod
[?] Please select an AWS config profile: aws-sso default dev-admin > qa-admin staging-admin prod-admin
How to use it
- Execute the following command to select and log into the aws accounts:
aws-sso-magic login
- Execute the following command to log:
aws-sso-magic login
and select the profile to use oraws-sso-login login --profile myprofile
if you already know the profile name.
How to use it for eks support
- Prerequisites
- kubectl installed.
aws-sso-magic login
oraws-sso-login login --profile myprofile
executed previouly.
- Instructions
-
Go to the file $HOME/.aws-sso-magic/eks and replace the string "replacethis" on the section default-proxy-role-name if you want to use that role name for all profiles.
[default-proxy-role-name] proxy_role_name = replacethis
or just add the profile section in the file. Eg:
[myprofile] proxy_role_name = myrolename
-
Execute the following command to select and log the eks cluster:
aws-sso-magic login --eks
-
Please select the EKS cluster
-
Copy and paste the commands according to your OS.
NOTE: If you will select another profile, please first unset the AWS_PROFILE environment variable or close this terminal and open a new one
Links
- pypi.org
- Docker Hub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws_sso_magic-1.0.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76285b9c08f6e734f67a1f9b7d53e9c88d065b4949ca8db7d539638db56f94b6 |
|
MD5 | 0f8a8e069bb92c8b28b6605ebcd8030d |
|
BLAKE2b-256 | 580d4dd61e0f3838f15d550f0cc2631bb27805c249635373770110bccd51e2ad |