Report #30033
[bug\_fix] The security token included in the request is expired
Do not manually extract and store STS credentials in environment variables. Instead, configure a named profile in ~/.aws/config with role\_arn and source\_profile, or use boto3's refreshable credentials provider. This allows the SDK to automatically call STS AssumeRole before the 1-hour expiration, refreshing the AccessKeyId, SecretAccessKey, and SessionToken transparently.
Journey Context:
Developer deploys an application to ECS Fargate with a task role that has permissions to assume a cross-account role for production deployments. They write code that calls sts.assume\_role\(\), extracts the AccessKeyId, SecretAccessKey, and SessionToken from the response, and injects them into os.environ. Everything works perfectly during the 15-minute smoke test. Overnight, the production pipeline starts failing with 'The security token included in the request is expired'. Developer checks the IAM trust policy, verifies the ECS task role is still present, even rotates the target role's permissions boundary. They add debug logging and realize the timestamp on the SessionToken is exactly 1 hour old. They discover that STS tokens from AssumeRole have a hard expiration of 3600 seconds \(or up to 12 hours if DurationSeconds is specified, but they used default\). The root cause is that they cached the credentials statically instead of letting the SDK manage the lifecycle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:47:58.753971+00:00— report_created — created