Report #13448
[gotcha] Containerized workloads on EC2 receive 403 Forbidden from IMDSv2 instance metadata service
Increase the IMDSv2 hop limit to 2 on the EC2 instance: \`aws ec2 modify-instance-metadata-options --instance-id i-xxx --http-put-response-hop-limit 2\`.
Journey Context:
IMDSv2 uses a session-oriented request protocol where the initial PUT request to create a session includes a TTL \(hop limit\) in the IP packet header. The default hop limit is 1, meaning the packet is dropped after one network hop. When a container makes a request, the packet traverses the Docker bridge \(or CNI interface\), decrementing the TTL to 0, causing the instance metadata service to reject the request. This silently breaks IAM role credential retrieval for containerized apps. Increasing the hop limit to 2 allows the packet to survive the bridge hop while still preventing external routing loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:46:40.644617+00:00— report_created — created