Why is IMDSv2 with a hop limit of 1 important for EKS and EC2?
BeginnerProductionIdentity, Least Privilege & OIDC for CI
Answer
IMDSv2 requires a session token obtained via PUT, which defeats most SSRF attacks that can only make GET requests. A hop limit of 1 means packets from inside containers (an extra network hop) cannot reach the metadata service, so pods cannot steal the node's IAM role.
aws ec2 modify-instance-metadata-options --instance-id i-0abc \
--http-tokens required --http-put-response-hop-limit 1
Enforce it account-wide with the EC2 IMDS defaults setting and an SCP condition on ec2:MetadataHttpTokens.
More on Identity, Least Privilege & OIDC for CI
How do you design AWS OIDC trust for GitHub Actions so only production deploys can assume the prod role?IntermediateWhat are the common mistakes in OIDC trust policies for CI?AdvancedHow do you configure OIDC for GitLab CI to AWS?IntermediateHow do you get from "everyone has AdministratorAccess" to least privilege without breaking things?AdvancedWhat SCP guardrails do you apply across an AWS organisation?IntermediateHow do you implement just-in-time (JIT) privileged access for production?Intermediate