imds — EC2 Instance Metadata Service

A zero-dependency, in-process emulator for the EC2 Instance Metadata Service (IMDS), supporting both IMDSv1 and IMDSv2.

PropertyValue
Port4719
ProtocolPlain HTTP REST
HealthGET /_parlel/health
ResetPOST /_parlel/reset

Default connection

AWS_EC2_METADATA_SERVICE_ENDPOINT=http://127.0.0.1:4719
AWS_REGION=us-east-1

The real IMDS lives at the link-local address 169.254.169.254. Point the AWS SDK at this emulator with AWS_EC2_METADATA_SERVICE_ENDPOINT.

Supported endpoints

PathResponse
GET /latest/meta-data/text listing
GET /latest/meta-data/instance-idtext
GET /latest/meta-data/instance-typetext
GET /latest/meta-data/ami-idtext
GET /latest/meta-data/local-ipv4text
GET /latest/meta-data/public-ipv4text
GET /latest/meta-data/hostnametext
GET /latest/meta-data/mactext
GET /latest/meta-data/placement/availability-zonetext
GET /latest/meta-data/placement/regiontext
GET /latest/meta-data/iam/security-credentials/text listing
GET /latest/meta-data/iam/security-credentials/{role}JSON creds
GET /latest/dynamic/instance-identity/documentJSON
PUT /latest/api/tokenIMDSv2 token

IMDSv1

Plain GET requests work directly — no token required.

IMDSv2

PUT /latest/api/token
  X-aws-ec2-metadata-token-ttl-seconds: 21600
=> <token>

GET /latest/meta-data/instance-id
  X-aws-ec2-metadata-token: <token>
=> i-1234567890abcdef0

GETs that carry a token header are validated; an invalid/expired token returns 401. GETs without a token header are served (IMDSv1 fallback).

SDK usage example

import {
  fromInstanceMetadata,
} from "@aws-sdk/credential-providers";

// Point the SDK at the emulator via env, then resolve credentials:
process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT = "http://127.0.0.1:4719";
const provider = fromInstanceMetadata();
const creds = await provider();

Access via MCP / preview URL

Point the SDK or any HTTP client at the allocated preview URL via AWS_EC2_METADATA_SERVICE_ENDPOINT.

Surface coverage

This emulator faithfully replicates the API surface most application code and agents exercise. Anything below the supported lines is either an intentional design choice for a fast, zero-cost local emulator (✓ By design) or a candidate for a future release (⟳ Roadmap) — never a silent inaccuracy.

Legend: ✅ fully supported · ◐ accepted (stored, not strictly enforced) · ✓ by design · ⟳ on the roadmap.

AreaLimitation
CredentialsSynthetic STS-style creds; not usable against AWS
User data/latest/user-data is not implemented
Network interfacesDetailed network/ tree is not implemented
Hop limit / IMDSX-Forwarded-For hop-limit policy not enforced
StateIn-memory only; lost on restart
<!-- parlel:testenv:start -->

Configuration — test.env

Copy these into your test.env (used by the bridge sidecar flow). Tokens are Parlel's seeded test credentials — any non-empty value is accepted by the emulator, so you rarely need to change them. Swap in real credentials only when pointing at the live service in prod.env.

AWS_ACCESS_KEY_ID=parlel
AWS_SECRET_ACCESS_KEY=parlel
AWS_REGION=us-east-1
AWS_EC2_METADATA_SERVICE_ENDPOINT=http://parlel-bridge:4719
AWS_ENDPOINT_URL=http://parlel-bridge:4719
<!-- parlel:testenv:end -->