Research Library · Idea
Cloud instance metadata service
The EC2 Instance Metadata Service is an endpoint that Amazon EC2 instances can reach at the link-local address 169.254.169.254, with an IPv6 equivalent of fd00:ec2::254 on supported Nitro instances. Software on the instance uses it to read data about the instance itself 1. When an IAM role is attached to the instance, the service also supplies the role's temporary security credentials, which AWS rotates automatically. AWS SDKs and the AWS CLI retrieve these credentials without explicit steps from the user 2.
Any software that can reach the endpoint can obtain those credentials. AWS therefore warns that services making HTTP calls on a workload's behalf can expose them. It names HTTP proxies, HTML and CSS validator services, and XML processors that support XML inclusion as examples 2.
Two versions exist. IMDSv2 is session-oriented and requires a token obtained through a PUT request. By default both versions are accepted, but an instance can be configured to accept only IMDSv2. Responses to token requests have a default hop limit of 1, and PUT requests that contain an X-Forwarded-For header are rejected 1.
Source · Use the Instance Metadata Service to access instance metadata (opens in a new tab) · Amazon Web Services
References
- Use the Instance Metadata Service to access instance metadata (opens in a new tab) · Amazon Web Services ↩ ↩
- Retrieve security credentials from instance metadata (opens in a new tab) · Amazon Web Services ↩ ↩

SecSIG