IMDSv2 (Instance Metadata Service version 2) is the secure replacement for IMDSv1 on Amazon EC2. It requires a session token obtained via an HTTP PUT request before any metadata can be accessed, preventing Server-Side Request Forgery (SSRF) attacks from stealing IAM role credentials.
169.254.169.254 with no authenticationPUT /latest/api/token with X-Aws-Ec2-Metadata-Token-Ttl-Seconds headerX-Aws-Ec2-Metadata-Token headeraws ec2 modify-instance-metadata-options \
--instance-id i-1234567890abcdef0 \
--http-tokens required \
--http-endpoint enabled
Use --http-tokens required to enforce IMDSv2. Set this as default for all new instances via account-level settings or SCPs.
Short-lived AWS credentials (access key, secret key, session token) issued by STS that expire automatically, eliminating the risk of permanent credential exposure.
An AWS identity with temporary credentials that can be assumed by users, services, or applications to perform actions without long-term access keys.
An attack that compromises a software dependency, build tool, or CI/CD pipeline to inject malicious code into downstream applications and steal credentials.
Toc Consulting: AWS Security & Cloud Architecture
Our team helps engineering teams secure and architect AWS the right way: assessment in week one, a prioritized action plan in week two.