Course contentsShow
← Security
Lesson 1932 of 3,05239. Cloud Security - Compute and ServerlessFree lesson

What is the Instance Metadata Service (IMDS)

Understanding IMDS purpose, how cloud instances retrieve configuration data, credentials, and network information at runtime.

What is the Instance Metadata Service (IMDS)?

You'll learn: How cloud instances dynamically retrieve their own configuration, credentials, and network information at runtime through a built-in metadata service.

The Core Idea

When a virtual machine (instance) launches in the cloud, it often needs to know things about itself: "What's my IP address?" "Which IAM role am I assigned?" "What's my instance ID?" The Instance Metadata Service (IMDS) is a special HTTP endpoint that lives at a magic IP address—169.254.169.254—accessible only from within the instance itself. It's like a self-service information desk built into every cloud VM.

Think of IMDS as your instance's internal mirror. When your application code or startup scripts need to discover their own identity, network configuration, or temporary security credentials, they make HTTP requests to this local endpoint. No internet access needed, no hardcoded values required.

Why This Matters for Security

IMDS serves temporary IAM credentials automatically rotated by the cloud provider. Applications retrieve these credentials from the metadata service rather than storing static keys in configuration files. This is far more secure—if you protect access to IMDS itself.

The metadata service also exposes user data (bootstrap scripts you provided at launch), network interface details, security group information, and even SSH public keys. If an attacker gains access to your instance, IMDS becomes a treasure trove of sensitive information.

Common IMDS Endpoints

  • /latest/meta-data/instance-id — Your instance's unique identifier
  • /latest/meta-data/iam/security-credentials/ — Temporary IAM credentials
  • /latest/meta-data/local-ipv4 — Private IP address
  • /latest/user-data — Bootstrap scripts and configuration

Key Takeaway: IMDS is the mechanism cloud instances use to discover their own configuration and retrieve temporary credentials at runtime—making it both essential for cloud operations and a critical security control point that must be protected against unauthorized access (especially from SSRF attacks).