Skip to content

Fix URL construction when running in Local Zones #3373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-urlresolution-88520.json
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 2 additions & 4 deletions botocore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion scripts/new-change
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down