Skip to content

Honor aws.endpoint for STS and S3 clients#1

Merged
da115115 merged 1 commit into
data-engineering-helpers:mainfrom
chrislusf:fix/aws-endpoint-override
May 6, 2026
Merged

Honor aws.endpoint for STS and S3 clients#1
da115115 merged 1 commit into
data-engineering-helpers:mainfrom
chrislusf:fix/aws-endpoint-override

Conversation

@da115115

@da115115 da115115 commented May 6, 2026

Copy link
Copy Markdown

Two builders inside the server were always targeting real AWS:

  • AwsCredentialGenerator.StsAwsCredentialGenerator built its StsClient with .region(...).credentialsProvider(...) only. There is no endpointOverride and aws.endpoint isn't propagated, so every AssumeRole goes to sts..amazonaws.com. AWS_ENDPOINT_URL_STS / AWS_ENDPOINT_URL env vars and the matching system properties don't kick in for that builder shape -- I confirmed by pointing AWS_ENDPOINT_URL_STS at port 1 and getting back the same real-AWS InvalidClientTokenId 403, with zero traffic to the configured port (sniffer in front).

  • FileIOFactory.getS3Client built its S3Client the same way, with no endpointOverride and forcePathStyle(false), so any Iceberg read against a self-hosted S3-compatible backend would also miss the endpoint and reject path-style URLs.

Add an aws.endpoint property + per-bucket s3.endpoint.N, plumb it through S3StorageConfig, and apply endpointOverride on both the StsClient and the S3Client when set. For the S3Client also flip to path-style when an endpoint is set, since SeaweedFS / MinIO / Ceph RGW / LocalStack typically can't issue wildcard certs for bucket.host.

Default empty -> AWS path is unchanged. Two new unit tests cover "endpoint set -> endpointOverride called with that URI" and "endpoint unset -> endpointOverride never called".

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Two builders inside the server were always targeting real AWS:

- AwsCredentialGenerator.StsAwsCredentialGenerator built its StsClient
  with .region(...).credentialsProvider(...) only. There is no
  endpointOverride and aws.endpoint isn't propagated, so every
  AssumeRole goes to sts.<region>.amazonaws.com. AWS_ENDPOINT_URL_STS
  / AWS_ENDPOINT_URL env vars and the matching system properties
  don't kick in for that builder shape -- I confirmed by pointing
  AWS_ENDPOINT_URL_STS at port 1 and getting back the same real-AWS
  InvalidClientTokenId 403, with zero traffic to the configured port
  (sniffer in front).

- FileIOFactory.getS3Client built its S3Client the same way, with
  no endpointOverride and forcePathStyle(false), so any Iceberg
  read against a self-hosted S3-compatible backend would also miss
  the endpoint and reject path-style URLs.

Add an aws.endpoint property + per-bucket s3.endpoint.N, plumb it
through S3StorageConfig, and apply endpointOverride on both the
StsClient and the S3Client when set. For the S3Client also flip to
path-style when an endpoint is set, since SeaweedFS / MinIO /
Ceph RGW / LocalStack typically can't issue wildcard certs for
bucket.host.

Default empty -> AWS path is unchanged. Two new unit tests cover
"endpoint set -> endpointOverride called with that URI" and
"endpoint unset -> endpointOverride never called".
@da115115 da115115 merged commit 07fe713 into data-engineering-helpers:main May 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants