Cloud instance metadata is a built-in service that tells a cloud server about itself, and can hand it temporary keys.
This guide is for students, newcomers to IT and anyone who looks after apps running in the cloud. You do not need to run servers yourself to be affected: if your organisation's website runs in the cloud, this service may hold keys to its data.
In short
- Every cloud server can ask a special address, 169.254.169.254, for facts about itself.
- If the server has a cloud identity, that address can also give it short-lived keys to other services.
- A flaw in an app can trick the server into fetching those keys for an outsider.
- Newer, stricter versions of the service, such as IMDSv2 on AWS, make that trick much harder, so turn them on.
What you will learn
- Explain what the metadata service is and why it exists.
- Spot why a web app flaw can turn into stolen cloud keys.
- Check whether your servers use the stricter version of the service.
- Ask your team the right questions about server permissions.
- Server facts service (instance metadata service)
- a service inside the cloud that answers a server's questions about itself.
- Short-lived keys (temporary credentials)
- keys that stop working after a set time, given to a server so it can use other services.
- Tricked request (SSRF)
- a flaw that lets an outsider make a server send a request on their behalf.
What is cloud instance metadata?
Think of a key safe inside a holiday cottage. Guests who are already inside can open it to find the wifi password and the spare keys. People outside the cottage cannot reach it.
A cloud server, often called an instance, has something similar. It can ask a special address for facts about itself, such as its name and network settings. This is the instance metadata service. AWS describes the data as being about your instance, used to set it up and manage it.[1]
The address is 169.254.169.254. It is a local address that works only from inside the server. AWS, Google Cloud and Microsoft Azure all use it (listed alphabetically).[2][4][5]
Many servers also have a cloud identity, so the app on them can use storage or databases. This is a kind of non-human identity (NHI): an identity used by software rather than a person. The metadata service hands that app short-lived keys for its identity, so nobody has to store long-lasting keys on the server.[1][4][5]
Where the comparison stops working: a key safe has a code. The older metadata service has no password at all. Any program on the server can ask it, and a flawed app can be tricked into asking on a stranger's behalf.[1]
Why does it matter?
The keys belong to the server's identity. Whoever holds them can do what that identity may do. If it can read every storage bucket (a cloud folder for files), so can they. Capital One said a 2019 incident, caused by a setup flaw, affected about 106 million people in the US and Canada.[6] Our Capital One breach page explains how a firewall's cloud role keys were taken.
If you build or test web apps
What could happen: a feature that fetches a web address for users is tricked into fetching the server's own keys.
Check this: any feature that fetches addresses typed by users should block internal addresses.
If you are new to cloud work
What could happen: you launch a server with the older, looser metadata setting and a powerful identity.
Check this: require the stricter metadata version and give the server only the access it needs.
If you manage a cloud team
What could happen: one small web flaw opens a path to data far beyond that one app.
Check this: ask for a list of servers still allowing the older metadata version.
What does it look like?
Here is a made-up card. It shows the kind of answer the service gives about a server's identity, in a simple layout.
Example only. All values are made up.
Asked from inside server shop-web-0000 Address asked: 169.254.169.254 (1) Answer: Identity: shop-web-role-EXAMPLE (2) KeyId: EXAMPLE-KEY-ID-0000 (3) SecretKey: FAKE-SECRET-0000-0000 Expires: 2026-11-28 18:00 (EXAMPLE) (4)
- The local address only the server itself can reach.
- In a real message, this line would name the cloud identity attached to the server.
- In a real message, these lines would contain working keys for that identity.
- The keys run out after a while, and the service hands out fresh ones.
Why this is risky: say an outsider tricks the app into fetching this answer. They now hold keys that work until they run out. They can use them from their own computer, with all the access the server has.
The safer way: turn on the stricter version, so a simple tricked request is turned away. Give the server only the access it needs, so stolen keys reach as little as possible.[2]
How does it work?
Here is the normal flow, then what changes with the stricter version.
- The server starts. The cloud gives it an identity, if one was chosen at launch.
- The app asks. The app on the server asks 169.254.169.254 for keys. The request never leaves the cloud host.[4]
- The service answers. It returns short-lived keys for the server's identity.[1]
- The app uses them. It reads storage or a database with those keys until they expire, then asks again.
- The stricter check. On AWS, the newer version, called IMDSv2, first needs a separate request to get a session token (a short-lived pass). Every later question must show that token. If tokens are required, questions without one get an error.[2]

The stricter design adds other safeguards too. AWS says IMDSv2 will not give a token to a request that looks like it passed through a proxy (a go-between server). The token answer is also set so it should not travel beyond the server itself.[2][3] AWS says this mix protects against the vast majority of these tricked request flaws.[3]
Each provider has its own guard (listed alphabetically). On AWS, servers accept both versions by default, so you choose to require IMDSv2.[2] Google Cloud turns away requests without a special header, Metadata-Flavor: Google.[5] Microsoft Azure needs the header Metadata: true and turns away requests that carry a proxy header.[4]

A worked example
Nadia Jovanovic runs the website for a fictional ticket agency. The site runs on a cloud server. One feature lets customers paste a link to a picture, and the server fetches it to show a preview.
Reza Zeller, a security tester the agency hired, checks the site. He finds the preview feature will fetch any address, including internal ones. He reports it at once and does not try to take any keys.
Nadia thinks of the cottage key safe. The preview feature is a guest who will open the safe for anyone who asks politely through the letterbox.
First, she looks at the server's settings. It still accepts the older metadata version. She switches it to require IMDSv2, after checking that the app's software is recent enough to support it.[2]
Next, she looks at the server's identity. It can read every storage bucket the agency owns, including old customer files. She cuts it down to the one bucket of event images it actually needs.
Then the developers change the preview feature so it refuses internal addresses.
Last, Nadia asks the team to check the other servers for the older setting. Reza tests again. The preview feature now turns the request away, and the server's identity can reach only event images.
Myths and mistakes
| What people think | What is true |
|---|---|
| Only someone already on the server can reach the metadata service. | A flawed app can be tricked into asking for an outsider, so the answer can leave the server. |
| The keys are short-lived, so stealing them does no harm. | They keep working until they expire, which can leave time to copy data. |
| It is a good place to keep passwords for the server. | AWS warns against storing passwords or long-lived keys in user data, because any software on the server may be able to read it.[1] |
| Turning on IMDSv2 alone fixes everything. | It blocks many tricked requests. Keeping the server's identity small limits what any stolen key can reach. |
| New servers always use the stricter version. | On AWS, servers accept both versions by default unless you require IMDSv2.[2] |
What can I do this week?
- Ask for a list of cloud servers that still accept the older metadata version.
- Require IMDSv2 on AWS servers, after checking the software on them supports it.
- Review what each server's identity can reach, and remove what it does not need.
- Find app features that fetch web addresses for users, and check they block internal addresses.
- Check that no passwords sit in server start-up settings.
Checklist
- Every AWS server requires IMDSv2.
- New servers are launched with the stricter setting from a template.
- Each server's identity can reach only what its app needs.
- No passwords or long-lived keys sit in server start-up settings.
- Features that fetch addresses for users block internal and local addresses.
- Software on servers is recent enough to use the stricter version.
- Someone checks regularly for servers that slip back to the older setting.
Common questions
What is 169.254.169.254?
It is a local address a cloud server uses to reach its own metadata service. It works only from inside the server. AWS, Google Cloud and Microsoft Azure all use it for this purpose, though each service answers in its own format.[2][4][5]
What is the difference between IMDSv1 and IMDSv2?
IMDSv1 answers simple questions with no extra step. IMDSv2 first needs a separate request for a session token, and later questions must show it. That extra step makes a simple tricked request much less likely to get an answer.[2]
Will turning on IMDSv2 break my apps?
It can, if an app uses old software that only speaks the older version. AWS lists minimum versions of its own tools that support IMDSv2. Check and update software first, then switch on the requirement, starting with a few test servers.[2]
Do containers and serverless apps have the same risk?
Often, yes. Containers running on a cloud server may be able to reach the same service, and AWS notes that settings changed for containers can widen exposure.[2] The same two fixes apply: block tricked requests and keep each identity's access small.
Can I just block the address?
Some teams do, on servers that never need it. Azure suggests local firewall rules as one way to limit access.[4] Many apps rely on the service for their keys, though, so test carefully and prefer the stricter version where apps need it.
Where next?
Ready for the detail? Read the practitioner guide: EC2 Instance Metadata Service Hardening Guide. It goes further into hop limits, account-wide defaults, logging and how to find servers still using IMDSv1.
Also useful:
- Cloud Instance Metadata Services Compared Guide
- SSRF Prevention Guide
- Server-Side Request Forgery for Beginners
- Cloud Workload Identities for Beginners
Related NHI Mgmt Group resources: AI Agent Runtime Credential Theft via Instance Metadata · Non-Human Identities for Beginners
Key terms
- Cloud instance metadata service
- A local service that tells a cloud server about itself and can hand it short-lived keys.
- IMDSv2
- The stricter AWS version of the metadata service, which needs a session token before it answers.
- SSRF
- A flaw that lets an outsider make a server send requests to places of the outsider's choosing.
- Temporary credential
- A key that works only for a limited time.
- IAM role
- An AWS identity that gives temporary keys to the person or program using it, such as a server.
- Least privilege
- Giving each person or program only the access it needs, and no more.
Sources and further reading
- Use instance metadata to manage your EC2 instance. Amazon EC2 User Guide, Amazon Web Services. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html, accessed 28 Nov 2026.
- Configure the Instance Metadata Service options. Amazon EC2 User Guide, Amazon Web Services. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html, accessed 28 Nov 2026.
- Add defense in depth against open firewalls, reverse proxies, and SSRF vulnerabilities with enhancements to the EC2 Instance Metadata Service. AWS Security Blog, Amazon Web Services, 19 November 2019 (updated 27 July 2021). https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/, accessed 28 Nov 2026.
- Azure Instance Metadata Service. Microsoft Learn, Microsoft. https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service, accessed 28 Nov 2026.
- Access VM metadata. Compute Engine documentation, Google Cloud. https://docs.cloud.google.com/compute/docs/metadata/querying-metadata, accessed 28 Nov 2026.
- 2019 Capital One Cyber Incident: What Happened. Capital One. https://www.capitalone.com/digital/facts2019/, accessed 28 Nov 2026.