Skip to content

Use IMDSv2 to discover the EC2 public endpoint - #15101

Merged
dguido merged 4 commits into
mainfrom
codex/ec2-imdsv2
Nov 25, 2026
Merged

dguido merged 4 commits into
mainfrom
codex/ec2-imdsv2

Conversation

@dguido

@dguido dguido commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

The installer requests a short-lived EC2 metadata token to discover the machine’s public IPv4 address. An explicit endpoint skips discovery. When EC2 cannot supply a public address, the installer asks the operator to provide one.

Some Lightsail images support only IMDSv1. If the token endpoint returns 404 or 405, the installer confirms that the metadata service belongs to AWS before reading the public address. A rejected token request or a timeout on EC2 asks the operator for an endpoint. Lightsail documentation

Refs #14510.

Verification

Tests cover running the installer as a file and piping it into Bash, token-based and legacy discovery, malformed responses, and failed requests. A loopback HTTP test used real curl to verify which requests sent a token. Additional fixtures covered DigitalOcean, Google Cloud, Azure, and the interface fallback. Cloud behavior was tested locally without provisioning a VM.

@dguido
dguido requested a review from jackivanov as a code owner November 25, 2026 19:27
@dguido
dguido merged commit 216fab3 into main Nov 25, 2026
12 checks passed
@dguido
dguido deleted the codex/ec2-imdsv2 branch November 25, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant