Package: aws-sso-magic
aws-sso-magic tool cliThis tool update the aws credentials file for the default profile from the aws sso login.This solution mixed the following repositories:aws-sso-utilAWS SSO has some rough edges, and aws-sso-util is here to smooth them out, hopefully temporarily until AWS makes it better.aws-sso-credentialsA simple Python tool to simplify getting short-term credential tokens for CLI/Boto3 operations when using AWS SSO.Content of the repositorysrc- The main folder with the aws_sso_magic folder with the .py files & the requirements.txt.aws_sso_magicdocker-build.sh- A docker build tool (Linux/MacOS) to build the docker image locally.sudo./docker-build.shpyproject.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-logindevelop-readonlyNOTE: I got this interesting repo ofmarianonamoroso, He developed an awesome shell script to get information from the eks cluster, for more details click onhttps://github.com/marianonamoroso/kubernetes, and heyy give to him an star :).InstallationUsing pyp installer- PrerequisitesPython 3.9installed.AWS CLI v2installed, please click on the link depending of your OS.- InstallationFollow the pypaw-sso-magicproject instructions to install it.Note: If you want upgrade it, please run thispip install aws-sso-magic --upgradeUsing DockerPlease follow the instructions from the docker hub repository ofaws_sso_magicConfiguration InstructionsThese 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 configureType the following information:SSO start URLSSO RegionSelect the default profile of SSOCLI default client RegionCLI default output formatCLI profile name. Eg: defaultEnter only the name of the proxy role to use by default. Eg: MyAdminRole or just press Enter (This option will mandatory for the --eks flag)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:[AliasAccounts]
test1 = dev
test2 = qa
test3 = staging
test4 = prodmaking the above configuration, it will now show the aliases in the profile selection menu when aws-sso-magic login command is executed.[?] Please select an AWS config profile:    
  dev-admin
> qa-admin 
  staging-admin   
  prod-adminHow to use itExecute the following command to select and log into the aws accounts:aws-sso-magic loginExecute the following command to log:aws-sso-magic loginand select the profile to use oraws-sso-magic login --profile ssoprofileif you already know the profile name.NOTE: If you don't want to copy the credentials to the default profile, you can use the --custom-profile flag to create the profile with the name that you prefer and copy the credentials there.
Eg:aws-sso-magic login --profile ssoprofile --custom-profile myprofileHow to use it for eks support- Prerequisiteskubectlinstalled.aws-sso-magic loginoraws-sso-magic login --profile myprofileexecuted previouly.- InstructionsGo to the file $HOME/.aws-sso-magic/config 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 = replacethisor just add the profile section in the file. Eg:[myprofile]
proxy_role_name = myrolenameExecute the following command to select and log the eks cluster:aws-sso-magic login --eksor if you have configured an aws account as trusted entity having granted to assume roles on the rest of the accounts from there, please executeaws-sso-magic loginselecting profile (account and role configured as trusted identity) and then executeaws-sso-magic login --eks --eks-profile env-eks-profile. Eg:aws-sso-magic login --profile main-admin
aws-sso-magic login --eks --eks-profile qa-adminPlease select the EKS cluster or send the cluster name using the flag --cluster. Eg:aws-sso-magic login --eks --cluster myeksclusterCopy 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 oneLinks- pypi.orgaw-sso-magic-Docker Hubaws_sso_magic