What’s the quickest way to verify AWS SSO before running a script?

August 28, 2026 1 answer
Asked by MellowCedar42
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?

Answers

OrbitingPine7
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`.

MellowCedar42: 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.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions