Skip to content

use_dualstack_endpoint=True does not fallback to regular endpoint #3060

@fluxth

Description

@fluxth

Describe the bug

When explicitly passing aioboto.config.Config(use_dualstack_endpoint=True) to a client:

client = boto3.client(
    "sts",
    region_name="ap-northeast-1",
    config=Config(use_dualstack_endpoint=True),
)

boto will always use https://{service}.{region}.api.aws endpoint for that service even if that service doesn't support dual stack.

Expected Behavior

use_dualstack_endpoint=True should fallback to regular endpoint when the dual stack endpoint does not exist.

For STS service, the dual stack endpoint at https://sts.ap-northeast-1.api.aws/ does not exist.
Boto should fallback to https://sts.ap-northeast-1.amazonaws.com/ endpoint in this case.

https://docs.aws.amazon.com/general/latest/gr/sts.html

Current Behavior

Boto will use non-existent dual stack endpoint for services that still doesn't support dual stack instead of falling back to the regular endpoint.

(see Reproduction Steps)

Reproduction Steps

This script should print the current STS identity.

import boto3
from botocore.config import Config

client = boto3.client(
    "sts",
    region_name="ap-northeast-1",
    config=Config(use_dualstack_endpoint=True),
)

response = client.get_caller_identity()

print(response)

But instead, we get this exception:

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://sts.ap-northeast-1.api.aws/"

Possible Solution

/botocore/data/endpoints.json file should have sufficient tagging to detect if a service has dual stack enabled.

Additional Information/Context

No response

SDK version used

boto3 = "1.28.64"

Environment details (OS name and version, etc.)

Fedora Linux 38

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions