I add a small check near the beginning of shell scripts that I share with my team so they can confirm they're authenticated with AWS SSO before the script continues: `aws configure list &>/dev/null || aws sso login`. As far as I know, this is one of the fastest ways to make sure an SSO session is available. Are there better or more reliable alternatives?
1 Answer
If you want to verify that the complete credential chain actually works, use `aws sts get-caller-identity`. Another option is `aws-vault`, which can manage and provide credentials for scripts. Keep in mind that `get-caller-identity` is noticeably slower than checking `aws configure list`.

That makes sense for validating the final identity, but the extra latency is why I’ve been sticking with `configure list` for these quick checks.