readimds 0.1.4

CLI for AWS EC2 IMDSv2 (Instance Metadata Service)
readimds-0.1.4 is not a library.

readimds

Small CLI for AWS EC2 IMDSv2 (Instance Metadata Service). Run on an EC2 instance to read instance metadata and instance tags without shelling out to curl.

Install

cargo install readimds

Usage

readimds [OPTIONS] <SUBCOMMAND>
Subcommand Description
token Get an IMDSv2 session token
metadata <path> Fetch a metadata path (e.g. instance-id, ami-id)
tag <key> Get an instance tag value (no newline; for VAR=$(readimds tag Name))

Run with no arguments or --help for the full usage guide.

Examples

# Session token
readimds token

# Instance ID and AMI
readimds metadata instance-id
readimds metadata ami-id

# Instance tag into a variable (no trailing newline)
NAME=$(readimds tag Name)
ENV=$(readimds tag Environment)

Requirements

  • Must run on an EC2 instance (IMDS is only available from the instance).
  • Instance metadata options: IMDSv2 required (or allow both v1 and v2). Token TTL used is 300 seconds.

License

MIT