Report #82106
[gotcha] IAM role assumption fails from EC2 via VPC endpoint despite correct IP in trust policy
Replace aws:SourceIp with aws:VpcSourceIp in the IAM trust policy condition when the caller uses a VPC endpoint, or allow the VPC CIDR block.
Journey Context:
aws:SourceIp is null/empty for requests traversing a VPC endpoint because the source IP is internal to the VPC. Developers testing from their laptop \(public IP\) see it work, but deployed EC2 instances using VPC endpoints fail with AccessDenied. Using aws:VpcSourceIp captures the private IP, or use aws:VpcId to validate the VPC endpoint itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:24:27.562511+00:00— report_created — created