A lightweight Go HTTP server that simulates cloud provider Instance Metadata Service (IMDSv1) and OpenStack metadata APIs. It reads node metadata and #cloud-config user-data from a YAML file to serve cloud instance initialization requests.
- IMDS Endpoints: Standard
/latest/meta-data/routes (instance-id,hostname,local-ipv4,public-ipv4,public-keys/). - User Data Endpoint:
/latest/user-dataserving raw#cloud-configcontent. - JSON Output:
/latest/meta-data.jsonreturning structured metadata. - Configurable: Load metadata definitions via
--configflag.
go run main.go --config metadata.yaml --port 8080# Get Instance ID
curl http://localhost:8080/latest/meta-data/instance-id
# Get Public SSH Key
curl http://localhost:8080/latest/meta-data/public-keys/0/openssh-key
# Get User-Data
curl http://localhost:8080/latest/user-datago test -v ./...MIT