Report #11598
[bug\_fix] AWS STS AssumeRole Static Credentials Expired \(ExpiredToken\)
Remove the hardcoded AWS\_ACCESS\_KEY\_ID, AWS\_SECRET\_ACCESS\_KEY, and AWS\_SESSION\_TOKEN environment variables from the process. Instead, configure a profile in ~/.aws/config with 'role\_arn' and 'source\_profile' pointing to a base profile \(or use 'aws configure sso' if using SSO\). The SDK will use the AssumeRoleProvider which automatically calls STS AssumeRole before expiry and refreshes the credentials. Hardcoding env vars prevents refresh.
Journey Context:
A data engineer runs a long-running Spark job on an EC2 instance that processes terabytes of S3 data. After exactly one hour, the job fails with 'ExpiredToken: The security token included in the request is expired'. The engineer checks the startup script and sees they ran 'aws sts assume-role --role-arn arn:aws:iam::111:role/ETLRole --duration-seconds 3600' and exported the returned Key/Secret/Token as env vars. They realize the token is hardcoded for 1 hour and the SDK cannot refresh it because it doesn't know how to re-assume the role. They modify ~/.aws/config to add '\[profile etl\]' with 'role\_arn = arn:aws:iam::111:role/ETLRole' and 'source\_profile = base' \(where base has EC2 instance profile or IAM user creds\). They unset the env vars and run the job. The SDK's AssumeRoleProvider automatically refreshes the token every hour, and the 3-hour job completes successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:45:38.867098+00:00— report_created — created