Remove ServiceMetadata usage from RDS/Neptune/DocDB presigning interceptors#7105
Conversation
f9baaaf to
09b86ef
Compare
RanVaknin
left a comment
There was a problem hiding this comment.
Can we please add 2 more tests to PresignRequestHandlerTest.java to cover when dualstack enabled and when fips is enabled (asserting that the endpoint is correctly resolving to the fips or dualstack modifier of that service, ie rds-fips.us-east-1.amazonaws.com)
This was missing from the existing tests, but since we are touching the interceptor here we should have a sane check to make sure the wiring for these modifiers is correct.
Added tests |
Motivation and Context
This is part of the ServiceMetadata removal effort to eliminate 350-500ms cold start latency caused by GeneratedServiceMetadataProvider initialization.
RDS, Neptune, and DocDB each have a RdsPresignInterceptor that generates presigned URLs for cross-region operations (e.g., CopyDBClusterSnapshot, CreateDBCluster). These interceptors call AwsClientEndpointProvider with serviceEndpointPrefix("rds") to resolve the endpoint for the source region. This triggers ServiceMetadata.of("rds"), which eagerly loads all 310 service metadata classes — adding 350-500ms of unnecessary initialization on every presigning call path.
This PR replaces that ServiceMetadata-based resolution with each service's Endpoints 2.0 provider, which resolves the same endpoint without triggering the expensive static initialization.
The endpoint resolved here is used as the host in the final presigned URL that gets sent to the service. The service validates this host when processing the presigned URL, so it must be the correct regional RDS endpoint, not a placeholder.
Modifications
Replaced AwsClientEndpointProvider usage in createEndpoint() with direct calls to each service's Endpoints 2.0 provider:
The endpoint params passed are region, useDualStack, and useFips — the same inputs the old code used. Null values for dualstack/fips are handled by the generated endpoint provider (treated as false, the declared default in the endpoint rule set).
Removed unused imports (AwsClientEndpointProvider, Protocol, SdkExecutionAttribute) and the SERVICE_NAME constant.
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License