Skip to content

Resolve IMDS region from placement/region endpoint#10374

Open
leezu wants to merge 1 commit into
aws:v2from
leezu:fix-imds-region-local-zone
Open

Resolve IMDS region from placement/region endpoint#10374
leezu wants to merge 1 commit into
aws:v2from
leezu:fix-imds-region-local-zone

Conversation

@leezu
Copy link
Copy Markdown

@leezu leezu commented Jun 2, 2026

Derive the region from the IMDS placement/region endpoint instead of stripping the last character of the availability zone. The previous heuristic produced an invalid region for Local Zones and Wavelength Zones (e.g. the AZ REGION-LOCALZONE-1a resolved to REGION-LOCALZONE-1 instead of REGION), which broke endpoint resolution for instances running in those zones.

Fall back to the availability-zone heuristic when placement/region is unavailable on older or third-party IMDS implementations.

To reproduce the issue, attempt listing an s3 bucket from within a local zone. It will fail unless region overwrite --region is passed to the aws cli command because it will attempt to access s3.dualstack.REGION-LOCALZONE-1.amazonaws.com which does not exist. S3 is regional and s3.dualstack.REGION.amazonaws.com should be used https://docs.aws.amazon.com/AmazonS3/latest/API/dual-stack-endpoints.html#dual-stack-endpoints-description

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Derive the region from the IMDS placement/region endpoint instead of
stripping the last character of the availability zone. The previous
heuristic produced an invalid region for Local Zones and Wavelength
Zones (e.g. the AZ us-east-2-sbn-1a resolved to us-east-2-sbn-1 instead
of us-east-2), which broke endpoint resolution for instances running in
those zones.

Fall back to the availability-zone heuristic when placement/region is
unavailable on older or third-party IMDS implementations.
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