Resolve IMDS region from placement/region endpoint#10374
Open
leezu wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
--regionis 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-descriptionBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.