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" +} 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): 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