feat(cubestore): Add CUBESTORE_S3_ENDPOINT for GovCloud and custom S3 endpoints #10281
+27
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check List
Summary
This PR adds support for custom S3 endpoints via a new
CUBESTORE_S3_ENDPOINTenvironment variable, enabling CubeStore to work with AWS GovCloud regions and other S3-compatible services that require explicit endpoint configuration.Problem
The
rust-s3library used by CubeStore has hardcoded support for standard AWS commercial regions:When you set
CUBESTORE_S3_REGION=us-gov-west-1, the library'sregion.parse::<Region>()doesn't recognize GovCloud regions. It falls back to creating:This results in malformed S3 URLs:
Instead of the correct:
Why not just pass the full URL as the region?
AWS Signature Version 4 uses the region name in the signature calculation:
If you pass
s3.us-gov-west-1.amazonaws.comas the region, the endpoint URL would be correct, but the signature would be invalid because AWS expects the signature to be calculated withus-gov-west-1.Solution
Add a new optional
CUBESTORE_S3_ENDPOINTenvironment variable that allows users to specify the S3 endpoint URL separately from the region.When
CUBESTORE_S3_ENDPOINTis set, CubeStore creates:Both values are correct for their respective purposes:
Usage
AWS GovCloud
AWS China
Custom S3-compatible storage (MinIO, LocalStack, etc.)
Affected Regions
This fix enables support for any region not hardcoded in
rust-s3, including:us-gov-west-1us-gov-east-1cn-north-1cn-northwest-1Changes
rust/cubestore/cubestore/src/config/mod.rsendpoint: Option<String>field toFileStoreProvider::S3enumCUBESTORE_S3_ENDPOINTenvironment variableS3RemoteFs::new()rust/cubestore/cubestore/src/remotefs/s3.rsendpoint: Option<String>parameter toS3RemoteFs::new()Region::Customwith proper endpoint URLregion.parse()behavior (backward compatible)rust/cubestore/cubestore/src/remotefs/mod.rsendpointparameterrust/cubestore/cubestore/src/sql/mod.rsendpoint: NoneinFileStoreProvider::S3structsBackward Compatibility
This change is fully backward compatible:
CUBESTORE_S3_ENDPOINTis optionalTesting
endpointparameterus-gov-west-1region confirmed working (can see cubestore objects created in S3 indicating the S3 connection works with the fix)Acknowledgments
Claude Opus 4.5 was used to analyze and fix this issue.