Currently aws sso login
is used to login to AWS OKTA and generate temporary credentials. But it does not support old .aws/credentials format which terraform still refers to as specified in bug AWS_issue_10851
* export AWS_ACCESS_KEY_ID=123; export AWS_SECRET_ACCESS_KEY=123; export AWS_SESSION_TOKEN=123
* If profile is already defined it replaces existing value of access_key_id, secret_access_ky, session_token
* If profile does not exist it adds to file
Add this folder to your path - export PATH=$PATH:aws_sso_login
aws login sso
eval $(inject_credentials.py)
- this sets your shell up with AWS environment variables
-
- This injects credentials from ~/.aws/cli/cache into ~/.aws/credentials and sets env variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN
- This can be invoked as -
inject_credentials.py [-h] [--profile PROFILE] [--aws-cred-file CREDENTIALS_FILE] [-v]
--profile
defaults todefault
--aws-cred-file
defaults to~/.aws/credentials
-v
for verbose debug loggin
-
- export AWS_CRED_FILE=""
-
- If using iTerm2,
- Create profile that runs shell cmd at startup -
eval $(inject_credentials.py)
- When using multiple tabs, instead of running
eval $(inject_credentials.py)
for each tab, close iTerm2, and reopen it. This causes all tabs to reopen and also run theeval $(inject_credentials.py)
script on startup
- Create profile that runs shell cmd at startup -