Interview Prep/AWS/IAM and Access Errors

`ExpiredToken: The security token included in the request is expired` in a long CI job. How do you fix it?

BeginnerTroubleshootingIAM and Access Errors
Answer

Likely causes → Assumed-role sessions last 1 hour by default and the job exceeded it, or cached credentials are stale.

Diagnose →

aws sts get-caller-identity
env | grep AWS_
aws iam get-role --role-name ci-deploy --query Role.MaxSessionDuration

Fix →

  1. Raise role MaxSessionDuration and request --duration-seconds accordingly
  2. Re-authenticate mid-job or split the job
  3. Unset stale AWS_SESSION_TOKEN variables left over from a prior step

Prevent → Use OIDC with fresh credentials per job and keep jobs short.

aws All AWS questions Roadmap: AWS core services

More on IAM and Access Errors