Join our Newsletter — 33% off our NHI Course
Home› Guides› Cloud Instance Metadata Services Compared Guide: AWS, Azure,…
Guide Cloud Security

Cloud Instance Metadata Services Compared Guide: AWS, Azure, Google Cloud and OCI Protections

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 13 min read
On this page

Every major cloud runs an unauthenticated HTTP endpoint at 169.254.169.254 on each virtual machine that will hand a workload credential to any process able to send it the right request, and each provider protects that endpoint differently. Teams that run in more than one cloud often harden the AWS metadata service and assume the others are equivalent. They are not: header requirements, legacy versions, the ability to switch features off and the identity each endpoint issues all differ. This guide compares the Amazon EC2, Azure, Google Compute Engine and Oracle Cloud Infrastructure metadata services side by side, then sets out a common baseline, detection approach and rollout plan. It is for cloud security architects, platform engineers and detection teams working across providers. Provider facts were checked against official documentation and client libraries on 27 October 2026; the AWS detail lives in the EC2 Instance Metadata Service Hardening Guide.

Key takeaways

  • All four services sit on the same link-local address and none requires the caller to authenticate; the protection is a request shape that a typical SSRF cannot produce.
  • Headers are the main defence: AWS IMDSv2 needs a PUT-issued token, Azure needs Metadata: true, Google needs Metadata-Flavor: Google and OCI IMDSv2 needs Authorization: Bearer Oracle.
  • AWS and OCI still ship a legacy, header-free version that you must turn off per instance or by policy; Google shut its legacy endpoints down in 2020; Azure has never offered one.
  • The credential matters more than the endpoint: any process on the VM can obtain the instance role, managed identity, service account token or instance principal certificate, so scope those identities tightly.
  • Containers change the threat model: pods reaching the node's metadata endpoint inherit the node identity unless you block them and use the platform's workload identity.

How identity and access work in cloud metadata services

The metadata service gives a VM information about itself (instance ID, network, tags, user data) and, more importantly, a credential for the identity attached to the VM. Cloud SDKs find that credential automatically. Because the endpoint is reachable from inside the instance without authentication, anything that can make the VM issue an HTTP request to it, such as a server-side request forgery bug, an open proxy or a compromised container, can obtain the credential. ATT&CK tracks this as T1552.005 Unsecured Credentials: Cloud Instance Metadata API. For the application-side flaw, see the SSRF Prevention Guide.

The four services compared

PropertyAWS EC2 IMDSAzure IMDSGoogle Compute Engine metadata serverOCI IMDS
Address169.254.169.254; IPv6 [fd00:ec2::254] on Nitro when enabled169.254.169.254, root /metadata169.254.169.254 or metadata.google.internal, root /computeMetadata/v1/169.254.169.254, root /opc/v2/
Protective requirementIMDSv2: PUT to obtain a session token (1 to 21,600 seconds), then header X-aws-ec2-metadata-tokenHeader Metadata: true; api-version parameter mandatoryHeader Metadata-Flavor: GoogleIMDSv2: header Authorization: Bearer Oracle
Forwarded header handlingPUT requests with X-Forwarded-For rejectedRequests with X-Forwarded-For rejectedConfirm with the vendorWith v2 only, requests with Forwarded, X-Forwarded-For or X-Forwarded-Host rejected
Legacy header-free versionIMDSv1, enabled unless configured otherwiseNot applicable; the header is mandatoryv0.1 and v1beta1 endpoints shut down on 30 September 2020IMDSv1 (/opc/v1, /openstack) until legacy endpoints are disabled
Extra network controlPUT response hop limit, default 1Primary NIC only; proxies must be bypassedConfirm with the vendorPrimary VNIC
Can it be switched off?Yes, HttpEndpoint disabledRestrict with local firewall rules; confirm with the vendorConfirm with the vendorLegacy endpoints can be disabled; v2 remains
Rate limits1,024 packets per second shared by link-local services5 requests per second; managed identity 20 per second and 5 concurrentConfirm with the vendorThrottled; no published figure

The credential each one issues

ProviderIdentityWhere it comes fromWho on the VM can use it
AWSIAM role via instance profileTemporary STS credentials from the metadata serviceAny process that can call IMDS
AzureSystem or user-assigned managed identityEntra ID access token from /metadata/identity/oauth2/token with a resource parameter (and client_id, object_id or msi_res_id when several user-assigned identities exist)Microsoft states that any code on the VM can request tokens for any managed identity available on it
Google CloudAttached service account, limited by access scopesOAuth access token from instance/service-accounts/<account>/tokenAny process that can call the metadata server
OCIInstance principal via dynamic group membershipCertificates delivered through the metadata service and rotated multiple times a dayOracle states that certificates are readable by all users on the instance and anyone who can SSH in inherits its privileges

The provider-specific identity guides go deeper on each: AWS STS and AssumeRole Guide, Azure Managed Identities Security Guide and Google Cloud IAM and Service Accounts Guide.

Admin roles and privileged access

A VM identity is a standing, non-human credential that every process and every user with a shell on the machine effectively holds. Treat the VM's attached identity as privileged when it can change infrastructure or read bulk data.

  • Scope the attached identity to the workload: in the Capital One breach, SSRF in a firewall reached the AWS metadata service, and the firewall's role could list and sync S3 buckets. The same pattern applies to an Azure managed identity with subscription Contributor or a Google VM running as a broadly privileged service account.
  • Avoid default identities: Google Compute Engine and GKE nodes use the Compute Engine default service account unless you choose another; Google recommends a dedicated least-privilege node service account. On AWS, do not reuse one instance profile across unrelated workloads.
  • Limit who can attach identities: the permission to attach a role, managed identity or service account to a VM (for example iam:PassRole on AWS) is an escalation path, because whoever launches the VM can then read its credential from inside.
  • Limit shell access: on OCI, Oracle says anyone who can SSH to an instance inherits its instance principal privileges. That is true in practice on every provider.
  • Know the non-revocable extras: every OCI instance principal automatically has compartment_inspect, which lets it list compartment names, descriptions and tags.

Integrations, API tokens and service accounts

Containers and Kubernetes nodes

A pod on a node can usually reach the node's metadata endpoint and, with it, the node identity. Each provider has a workload identity mechanism that should replace node credentials for pods.

PlatformBlock pods from node metadataGive pods their own identity
Amazon EKSRequire IMDSv2 with hop limit 1 on nodes; do not disable IMDS, as node components rely on itIAM Roles for Service Accounts or EKS Pod Identity
Google Kubernetes EngineWorkload Identity Federation for GKE, which Google says replaces metadata concealment and recommends in all situations; node metadata includes kube-env with kubelet credentialsWorkload Identity Federation for GKE
Azure Kubernetes ServiceRestrict with network policy or host firewall rulesMicrosoft Entra Workload ID for pods
OCI Kubernetes EngineDisable legacy IMDS endpoints on nodes and restrict node instance principal policiesProvider workload identity where available

See the EKS Identity Hardening Guide, the GKE Identity Hardening Guide and the Kubernetes NHI Security Guide.

Agents, SDKs and images

  • AWS: IMDSv2 needs minimum SDK versions (for example AWS CLI 1.16.289 and Boto3 1.12.6). Migration detail is in the EC2 Instance Metadata Service Hardening Guide.
  • OCI: IMDSv2 needs supporting images: Oracle Linux 7.x and 8.x released July 2020 or later, custom Linux images with cloud-init 20.3+ and Oracle Cloud Agent 0.0.19+, and custom Windows images with Oracle Cloud Agent 1.0.0.0+ (confirm cloudbase-init images with Oracle before switching). Confirm image support before disabling IMDSv1, or the instance can be unreachable after launch.
  • Azure: clients must bypass proxies for IMDS, even where none is configured, because proxy settings can be discovered automatically later. Running IMDS through a proxy is unsupported.
  • All providers: cache tokens until near expiry rather than fetching per request; each provider throttles the endpoint and recommends exponential back-off.

Logging and detection

Metadata requests are local and are not recorded in any provider's control plane logs. Detection therefore relies on configuration posture and on spotting the credential being used somewhere it should not be.

ProviderPosture signalCredential misuse signal
AWSCloudWatch MetadataNoToken and ImdsV1Enabled; instances with HttpTokens optionalGuardDuty InstanceCredentialExfiltration.OutsideAWS and .InsideAWS; CloudTrail calls by the instance role from unexpected IPs
AzureInventory of VMs with managed identities and their role assignmentsManaged identity sign-in logs in Entra ID and Azure Activity Log operations by the identity from unexpected sources
Google CloudVMs and nodes running as the default service account or with broad access scopesCloud Audit Logs entries where the VM's service account is the principal, from outside its expected network
OCIareLegacyImdsEndpointsDisabled false in GetInstance or ListInstancesAudit service events where principalId is the instance OCID, from unexpected sources

On the instance itself, an EDR or host log rule that flags unexpected processes connecting to 169.254.169.254 catches abuse that the cloud logs miss. Web application firewall and proxy logs showing the address, metadata.google.internal or /latest/meta-data in request parameters are a strong SSRF indicator. Map these to T1552.005, T1190 Exploit Public-Facing Application and T1078.004 Valid Accounts: Cloud Accounts.

Metrics

  • Legacy metadata exposure: share of AWS instances with IMDSv1 enabled and OCI instances with legacy endpoints enabled; target zero.
  • Default identities: count of Google VMs on the default service account and AWS instances sharing a generic instance profile.
  • Privileged VM identities: VM identities with administrative or bulk data permissions, each with a named owner.
  • Pods on node identity: Kubernetes workloads still using node credentials rather than workload identity.
  • Time to contain a credential exfiltration alert.

Hardening baseline

ControlAWSAzureGoogle CloudOCI
Require the protected versionHttpTokens required; account enforcement or declarative policyBuilt in (Metadata: true)Built in (Metadata-Flavor: Google)areLegacyImdsEndpointsDisabled true ("Version 2 only")
Restrict local accessHop limit 1 for container hosts; host firewall for specific processesLocal firewall rules allowing only specific processes, as Microsoft advisesHost firewall; Workload Identity Federation for GKEHost firewall; restrict SSH
Least privilege identityWorkload-specific instance profileUser-assigned identity per workload, scoped role assignmentsDedicated service account, no default accountNarrow dynamic group matching rules and compartment-scoped policies
Bind credential to networkaws:Ec2InstanceSourceVpc condition with VPC endpointsConditional Access for workload identities where licensedVPC Service ControlsScoped policies; confirm other options with the vendor
Detect misuseGuardDutyEntra and Activity logsCloud Audit LogsAudit service

Rolling out a cross-cloud baseline

  1. Inventory: list every VM and node with an attached identity in each cloud, with that identity's permissions.
  2. Remove legacy access: on AWS follow the IMDSv2 migration; on OCI check image support, then set "Version 2 only" on a pilot group, watch for broken agents, then widen. Rollback on OCI is selecting "Version 1 and version 2" and restarting the instance.
  3. Shrink identities: replace default and shared identities with workload-specific ones, starting with internet-facing VMs.
  4. Move pods off node identity to IRSA or EKS Pod Identity, Workload Identity Federation for GKE or Entra Workload ID, then block pod access to node metadata.
  5. Add host controls where the provider offers no header-level legacy switch, for example local firewall rules on Azure VMs that limit metadata access to the agents that need it.
  6. Turn on detection per provider and add a common SSRF indicator rule in the WAF and proxy layer.

Choosing priorities: a single-cloud estate should finish that provider's legacy removal first. A multi-cloud estate gets most value from the identity step, because a tightly scoped VM identity limits the damage whichever endpoint leaks. Small teams can rely on provider defaults plus least privilege; large estates should enforce the AWS and OCI settings through organisation-level policy and report posture centrally. For the wider cross-cloud identity picture, see the Multi-Cloud Identity Guide.

Common misconfigurations

  • Hardening one cloud only: AWS IMDSv2 is enforced while OCI instances still answer header-free requests on /opc/v1.
  • Assuming a header requirement stops every SSRF: a bug that lets the attacker set arbitrary headers defeats Azure's and Google's protections, and a bug that controls the method and headers defeats AWS IMDSv2. Fix the SSRF and limit egress.
  • Proxies in front of metadata: a forward proxy or sidecar that adds the required header on behalf of callers recreates the legacy exposure; Microsoft's guidance is to bypass proxies for IMDS.
  • Several user-assigned identities on one Azure VM: any code on the VM can request a token for any of them, so the VM holds the union of their access.
  • Default service accounts on Google VMs and GKE nodes: one compromised workload inherits project-wide permissions.
  • Pods reaching node metadata: on GKE that can expose kube-env with kubelet credentials; on EKS it exposes the node role.

Framework mapping

FrameworkReferenceMetadata service control
NIST CSF 2.0PR.PS-01, PR.AA-01, PR.AA-05, DE.CM-09Secure configuration, workload identity management, least privilege, runtime monitoring
NIST SP 800-53 Rev. 5CM-6, CM-7, AC-6, IA-9, SI-4Metadata settings, disabling legacy endpoints, scoped VM identities, service authentication, monitoring
CIS Controls v8.14 Secure Configuration, 5 Account Management, 6 Access Control ManagementBaseline per provider, VM identity inventory, least privilege
ISO/IEC 27001:2022 Annex A8.9, 5.16, 8.2Configuration management, identity management, privileged access
MITRE ATT&CK v20T1552.005, T1190, T1078.004Metadata credential theft, SSRF entry, use of stolen cloud credentials

Practitioner checklist

  • Inventory every VM and node identity in every cloud, with permissions and an owner.
  • Require AWS IMDSv2 and enforce it at account or organisation level.
  • Disable OCI legacy IMDS endpoints after confirming image and agent support.
  • Replace Google default service accounts on VMs and GKE nodes with dedicated accounts.
  • Limit Azure VMs to the managed identities they need and restrict metadata access with host firewall rules where practical.
  • Move Kubernetes pods to workload identity and block pod access to node metadata.
  • Remove any proxy or sidecar that adds metadata headers for other processes.
  • Enable per-provider credential misuse detection and a WAF rule for metadata addresses in requests.
  • Review who can attach identities to VMs, since that grants access to the credential.

Standards and references

Related NHI Mgmt Group resources: EC2 Instance Metadata Service Hardening Guide · SSRF Prevention Guide · Multi-Cloud Identity Guide · Cloud Workload Identity Guide · Oracle Cloud Infrastructure Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.