aws / aws/aws-cli

Endpoint URL construction incorrect when running inside of Local Zone

Open
#7,043 6 comments 16 reactions 0 assignees View on GitHub
bug imds p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

The aws-cli builds/returns the wrong endpoint when running on a host in a Local Zone.
ex.: https://sts.us-west-2-den-1.amazonaws.com/

### Expected Behavior

The aws-cli should correctly build endpoints to the Local Zones parent region
ex.: https://sts.us-west-2.amazonaws.com/

### Current Behavior

```
# /usr/local/bin/aws --version
aws-cli/2.7.7 Python/3.9.11 Linux/5.4.196-108.356.amzn2.x86_64 exe/x86_64.amzn.2 prompt/off

# /usr/local/bin/aws configure list
Name Value Type Location
---- ----- ---- --------
profile None None
access_key ****************UMSL iam-role
secret_key ****************OtzT iam-role
region us-west-2-den-1 imds

# /usr/local/bin/aws sts get-caller-identity

Could not connect to the endpoint URL: "https://sts.us-west-2-den-1.amazonaws.com/"
```

### Reproduction Steps

```
# /usr/local/bin/aws --version
aws-cli/2.7.7 Python/3.9.11 Linux/5.4.196-108.356.amzn2.x86_64 exe/x86_64.amzn.2 prompt/off

# /usr/local/bin/aws configure list
Name Value Type Location
---- ----- ---- --------
profile None None
access_key ****************UMSL iam-role
secret_key ****************OtzT iam-role
region us-west-2-den-1 imds

# /usr/local/bin/aws sts get-caller-identity

Could not connect to the endpoint URL: "https://sts.us-west-2-den-1.amazonaws.com/"
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CLI version used

2.7.7

### Environment details (OS name and version, etc.)

Amazon Linux 2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.