-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 - Support virtual-hosted style buckets #1823
base: master
Are you sure you want to change the base?
Conversation
- rusoto_s3 crate: - For now, exploring a solution by manually modifying "generated.rs". Later, I will apply the changes to the code generators in service_crategen. - Add AddressingStyle enum to s3::util module and make the Auto variant as the default. - Add S3Config struct with addressing_style field to s3::util module. - rusoto_core crate: - Add InvalidDnsName variant to RutotoError in rusoto_core crate. - rusoto_signature crate: - Add extract_hostname() method to Region enum (WIP)
- service_crategen crate: - Update codegen, rest_xml and rest_request_generator modules to generate extra codes for S3 service to handle different addressing styles. - rusoto_s3 crate: - No more manual edits on "generated.rs". - Change the default valiant for AddressingStyle enum from Auto to Path for now, in order to make auto-generate unit tests to pass. - rusoto_signature crate: - Remove extract_hostname() method from Region enum. This method was added by a previous commit.
- rusoto_s3 crate: - Update PreSignedRequest implementation to support S3 addressing styles.
- service_crategen crate: - Add `pub` to generated build_s3_hostname() method of S3Client. - Remove a blank line in generated codes right above the client struct.
- rusoto_tests crate (aka integration_tests) - Fix compile errors due to the changes in PreSignedRequest implementation in previous commit.
There is an open pull request #1817 to remove regex dependency from rusoto_credential crate. In this pull request, I have added a regex dependency to rusoto_s3 crate. Maybe I should remove it. The regex matcher here is simple enough and can be easily replaced with some Rust codes. rusoto/services/s3/src/custom/util.rs fn is_valid_dns_name(bucket_name: &str) -> bool {
use lazy_static::lazy_static;
use regex::Regex;
// ...
lazy_static! {
static ref LABEL_RE: Regex = Regex::new(r"[a-z0-9][a-z0-9\-]*[a-z0-9]").unwrap();
}
LABEL_RE.is_match(bucket_name)
} |
- rusoto_s3 crate: - Remove regex crate usage from is_valid_dns().
Update the CHANGELOG.
- rusoto_s3 crate: - Change the default of AddressingStyle from Path to Auto. - Update the custom_tests to check virtual-hosted-style URI. - rusoto_tests crate (aka integration_tests) - Update the TestS3Client to set S3Client's addressing style based on the value of an environment variable S3_ADDRESSING_STYLE. - Update tests with Ceph and Minio to keep using S3 path-style URI because we do not have DNS setup for them and virtual-hosted-style will not work.
OK. I removed the regex dependency from this pull request in this commit. |
- rusoto_tests crate (aka integration_tests) - Update tests with Minio to use S3 virtual-hosted-style URI. - Update TestS3Client and reqwest::Client to set HTTP proxy to the URI specified by an environment variable S3_PROXY. This setting is needed to run tests with virtual-hosted-style URI without having a local DNS server.
- rusoto_tests crate (aka integration_tests) - Create another set of Minio and Ceph tests so that we can test both S3 virtual-hosted-style URI and path-style URI. - Fix some presigned-URL tests in the s3 module; they were using virtual-hosted-style URI regardless the S3_ADDRESSING_STYLE value.
- rusoto_tests crate (aka integration_tests) - Reorder test scripts in .semaphoreci so that CI does not have to pull and purge the same Docker images twice.
Hello is there any progress on this? 😄 |
@kennytm – Hi. I am basically done with all coding stuff here. I want to add some test cases and documentation. I will work on them in coming weekend. |
Sorry for the big delay. I am planning to work on this in this week. |
Would this also fix #1742? |
This feature is so important but without any update .. 🎱 |
Conflicts: .semaphoreci/test_11_clean_docker_images.sh ci/test_11_ceph_path_style.sh ci/test_11_clean_docker_images.sh ci/test_12_clean_docker_images.sh ci/test_21_clean_docker_images.sh ci/test_21_minio_path_style.sh ci/test_22_clean_docker_images.sh integration_tests/README.md rusoto/services/s3/src/generated.rs
Remove obsolete CI scripts.
Update the Hyper version for the integration tests.
@tatsuya6502 is there a schedule on reviewing this feature? https://github.com/tikv/rusoto already integrates your patch and push it onto production by tikv/tikv#9425 . If we can get this feature in upstream, we can brining it to a wider range of developers. Looking forward to your update. |
Looks good, @tatsuya6502, can you convert this from a draft to a full PR please? 👍🏻 |
Hi @iliana. Some users still need virtual hosted style access for S3. I did some work here but it is pretty outdated now, so I will need to rebase it. If I do it, is there any chance that this PR will be merged? I see the followings on the README, so I am curious: https://github.com/rusoto/rusoto#maintenance-status
|
At this point this PR is a bugfix and should get prioritized. |
@zoonman I don't believe that there's any maintainer of Rusoto left, as most people have left Amazon or are no longer interested in supporting Rusoto. You're probably better off using the AWS Rust SDK at this point. |
The issue with the AWS Rust SDK is that the project README clearly states that it is not production ready. |
The official AWS SDK for Rust is that project.
Full disclosure: I used to work on the AWS Rust SDK, but haven't for a little bit, so I hope don't think that I'm speaking out of turn for the team that currently works on it. I have shared similar things sentiments with my folks at my current employer with the team's okay, but since this issue might have larger reach, I'll speak in more general terms. With that out of the way: if you stick with the high-level, vanilla clients in a relatively vanilla way (e.g., using the AWS Rust SDK clients as you would use the Rusoto clients), run For context, AWS has an extremely high bar for what they consider to be "generally available" or "production ready". They consider security backports to older versions and something like a 5+ year stability policy necessary to be labeled "generally available"; the AWS Rust SDK cannot yet commit to such things. If you need those things, then yes: the AWS SDK for Rust isn't ready for you, but if you're commenting on this issue, I strongly suspect that it's not a hard requirement. |
FYI. The official AWS SDK S3 for Rust now supports virtual-hosted style bucket. It is enabled by default.
https://github.com/awslabs/aws-sdk-rust/releases/tag/release-2023-01-13
|
Referenced rusoto#1823 for code changes.
Referenced rusoto#1823 for code changes.
Referenced rusoto#1823 for code changes.
Referenced rusoto#1823 for code changes.
Referenced rusoto#1823 for code changes.
[WIP] This pull request adds support for S3 virtual-hosted addressing style to rusoto_s3 crate.
Without this change, users of rusoto_s3 crate cannot access Amazon S3 buckets created after September 30, 2020.(Update: AWS has announced that they will delay the deprecation) This is because AWS has deprecated path-style addressing, which is the only style supported by current rusoto_s3 release. See this blog post from AWS for more details of the path-style deprecation.Fixes: #1482, #1789
Breaking Changes
This pull request includes breaking changes:
S3Client
to use virtual-hosted-style whenever possible and to fall back to path-style when necessary.S3Client
back to path-style.rusoto_s3::util::AddressingStyle
) (TODO)get_presigned_url()
fromString
to
Result<String, InvalidDnsNameError>
.API Changes
This pull request has the following API additions and changes:
rusoto_s3::util::AddressingStyle
with variantsAuto
,Virtual
andPath
.Auto
.s3.addressing_style
in Boto3.rusoto_s3::util::S3Config
, which has only one public fieldaddressing_style
.config: S3Config
torusoto_s3::S3Client
.addressing_style
torusoto_s3::util::PreSignedRequestOption
.rusoto_core::error::InvalidDnsNameError
.InvalidDNSNameError
exception in Boto3.rusoto_core::error::Rusoto
get_presigned_url()
fromString
to
Result<String, InvalidDnsNameError>
.The Behavior of
AddressingStyle
AddressingStyle
provides the same behavior tos3.addressing_style
in Boto3 (Reference).Here are some details (copied from an issue comment of #1482)
Automated Testing (CI)
This pull request includes some additional unit tests (IN-PROGRESS).
The existing unit tests are updated to use
AddressingStyle::Auto
and some unit tests are added forListAllBuckets
andGetBucketLocation
, which requireAddressingStyle::Path
.The integration tests provided by rusoto_tests crate has the following changes:
rusoto_tests::s3
:S3_PROXY
to set the HTTP proxy URL to the test S3/HTTP clients.S3_ADDRESSING_STYLE
to set the addressing style in S3 client and presigned URL. (Only valuepath
is recognized forPath
variant, otherwiseAuto
variant is used)AddressingStyle::Auto
.http://s3.us-east-1.rusoto.example.com:9000
to MinIO server and also toS3Client
.http:://172.0.0.1:9000
as the proxy of theS3Client
and, for testing presigned URLs, the proxy ofreqwest::Client
.AddressingStyle::Path
.Notes