From adcbc67e4c46d931283cca0cb47ada6865672495 Mon Sep 17 00:00:00 2001 From: Andrew Asseily Date: Fri, 31 Jan 2025 16:15:31 -0500 Subject: [PATCH 1/3] Update IMDS region fetcher to use region instead of availability-zone --- botocore/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/botocore/utils.py b/botocore/utils.py index 30a513ea90..86823e0ee4 100644 --- a/botocore/utils.py +++ b/botocore/utils.py @@ -756,7 +756,7 @@ def _create_fetcher(self): class InstanceMetadataRegionFetcher(IMDSFetcher): - _URL_PATH = 'latest/meta-data/placement/availability-zone/' + _URL_PATH = 'latest/meta-data/placement/region/' def retrieve_region(self): """Get the current region from the instance metadata service. @@ -788,9 +788,7 @@ def _get_region(self): retry_func=self._default_retry, token=token, ) - availability_zone = response.text - region = availability_zone[:-1] - return region + return response.text def merge_dicts(dict1, dict2, append_lists=False): From 2a2c4c7823e38d088e697ade031c9643fe394605 Mon Sep 17 00:00:00 2001 From: Andrew Asseily Date: Mon, 3 Feb 2025 16:08:26 -0500 Subject: [PATCH 2/3] Unintentional word repitition --- scripts/new-change | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/new-change b/scripts/new-change index b902c63364..da90c0c63e 100755 --- a/scripts/new-change +++ b/scripts/new-change @@ -29,7 +29,7 @@ You'll see this template:: Fill in the appropriate values, save and exit the editor. Make sure to commit these changes as part of your pull request. -If, when your editor is open, you decide don't don't want to add a changelog +If, when your editor is open, you decide don't want to add a changelog entry, save an empty file and no entry will be generated. You can then use the ``scripts/gen-changelog`` to generate the From f2584b077ecf3c34944d1903ce21355726a3e933 Mon Sep 17 00:00:00 2001 From: Andrew Asseily Date: Mon, 3 Feb 2025 16:20:01 -0500 Subject: [PATCH 3/3] Add changelog entry for Local Zone URL construction fix --- .changes/next-release/bugfix-urlresolution-88520.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/next-release/bugfix-urlresolution-88520.json diff --git a/.changes/next-release/bugfix-urlresolution-88520.json b/.changes/next-release/bugfix-urlresolution-88520.json new file mode 100644 index 0000000000..255c7b690a --- /dev/null +++ b/.changes/next-release/bugfix-urlresolution-88520.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "url-resolution", + "description": "Fixes URL construction in Local Zones by using region directly instead of attempting to parse availability zone" +}