Replies: 1 comment 1 reply
|
AWS CLI does not have a built-in “only login if needed” mode for
A practical script pattern is: profile=${1:-mine} aws --profile "$profile" sts get-caller-identity >/dev/null 2>&1 || aws --profile "$profile" s3 ls If you want to see whether you have a valid token, AWS CLI stores SSO tokens in the cache under: ~/.aws/sso/cache/ Those files are JSON and include an ls -1 ~/.aws/sso/cache/*.json cat ~/.aws/sso/cache/.json If you’re working across many profiles/roles, use the newer shared SSO session configuration ( In short: Don’t call Probe with a cheap call (like Token state is visible in |
Uh oh!
There was an error while loading. Please reload this page.
Say I have a script that requires sso login to work. My expectation is that if I already have valid tokens
aws sso loginwould be fast, instead the behaviour onaws-cli/2.17.64 Python/3.12.6 Darwin/23.6.0 source/arm64is to login AGAIN. A workaround is something like:Could it please be improved?
Tbh I am not sure how to see my valid tokens since I work across many profiles / roles.
All reactions