Skip to content

Improve regional STS endpoint UX #1745

@copumpkin

Description

@copumpkin

For historical reasons, most AWS SDKs continue to hit the global STS HTTPS endpoint even if you request a particular region, and if you want to hit the regional STS endpoints you need to explicitly override the client region and endpoint.

Some SDKs like the Go SDK have introduced slightly friendlier ways to do this, allowing client builders to specify a boolean flag saying "yes I do actually want the regional STS endpoints".

The experience with aws-sdk-java-v2 isn't ideal. I can do the following:

StsClient.builder()
      .region(region)
      .endpointOverride(endpoint)
      .build()

But the question then becomes what I should use for that endpoint URI. At first glance, I thought StsClient.serviceMetadata.endpointFor(region) would be perfect, since it also returns a URI. But no, even though the type is correct, the URI it returns seems to have no https:// on it and the client builder barfs on that. Furthermore, the Java URI class has no pleasant way to take one URI and add a scheme to it, so you have to resort to string manipulation and prepend https:// to the string before the client will accept it, and deal with various URI builder exceptions along the way.

It would be great to be able to specify .useRegionalStsEndpoints(true) on the STS client builder so I don't even have to think about endpoint URIs (which are often quite different depending on which partition you hit), or if we can't have that, then for endpointFor to include a scheme so we don't have to massage its output before the client accepts it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions