Skip to content

feat(aws): resolve endpoints by service - #415

Open
aryasaatvik wants to merge 2 commits into
alchemy-run:mainfrom
aryasaatvik:feat/aws-service-endpoints-upstream
Open

feat(aws): resolve endpoints by service#415
aryasaatvik wants to merge 2 commits into
alchemy-run:mainfrom
aryasaatvik:feat/aws-service-endpoints-upstream

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Route individual AWS SDK services to distinct endpoints while preserving the existing operation-scoped Endpoint override and generated Smithy endpoint fallback.

API

Effect.provideService(Endpoint.ServiceEndpoint, {
  resolve: (service) =>
    service === "S3" ? "http://127.0.0.1:9000" : undefined,
});

The resolver receives the model's SDK service ID, so services that share a SigV4 name, such as SES and SESv2, remain independently routable.

Resolution order

Priority Source Behavior
1 Endpoint Explicit operation-scoped override
2 ServiceEndpoint Service-specific resolver
3 Smithy rules / default Existing AWS endpoint selection

The same resolution path is used by generated operations and S3 presigning.

Validation

  • mise exec bun@1.3.13 -- bun test packages/aws/test/endpoint.test.ts — 7 passing tests
  • oxfmt --check on the four changed files

@aryasaatvik
aryasaatvik force-pushed the feat/aws-service-endpoints-upstream branch from f25e582 to df5b912 Compare August 4, 2026 20:22
Add `ServiceEndpoint`, a resolver keyed by the SDK service ID exactly as
it appears in the model's `aws.api#service` trait (`"S3"`, `"SESv2"`,
`"S3 Control"`), and `Endpoint.resolve(service)` which layers it under
the existing `Endpoint` override:

1. an explicit operation-scoped `Endpoint` wins,
2. then the `ServiceEndpoint` resolver,
3. otherwise `undefined`, leaving the generated Smithy endpoint rules to
   select the AWS endpoint as before.

`protocol.ts` and `presign.ts` now go through `Endpoint.resolve` instead
of reading `Endpoint` directly, so a process-wide per-service policy
(local emulator, private endpoints) applies without every call site
providing an `Endpoint`.

The key is the SDK service ID rather than the SigV4 signing name because
signing names collide (SES and SESv2 both sign as `ses`); SDK IDs keep
every service independently routable, and they are the identifier AWS's
own service-specific endpoint configuration
(`AWS_ENDPOINT_URL_<SERVICE>`, `~/.aws/config` `services` sections) is
derived from.
@aryasaatvik
aryasaatvik force-pushed the feat/aws-service-endpoints-upstream branch from df5b912 to 12c84d3 Compare August 24, 2026 10:42
aryasaatvik added a commit to aryasaatvik/alchemy that referenced this pull request Aug 24, 2026
Pin the exact reviewed head of Distilled alchemy-run#415 before introducing Alchemy's service-routed endpoint consumer.

Upstream-PR: alchemy-run/distilled#415

Upstream-Head: 12c84d36ba8390127464d9a44b80de272c79bcf4

Overlay-Reason: immutable cross-repository verification dependency
aryasaatvik added a commit to aryasaatvik/alchemy that referenced this pull request Aug 24, 2026
Accept service-specific emulator endpoints throughout the AWS provider environment and dispatch each Distilled operation to its configured service URL.

Original-Commit: ea2223042

Dependency-PR: alchemy-run/distilled#415

Dependency-Head: 12c84d36ba8390127464d9a44b80de272c79bcf4

Upstream-Candidate: AWS service endpoints
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.

1 participant