Skip to content
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

How to enable path style for s3 services? #390

Closed
2 tasks done
Xuanwo opened this issue Jan 9, 2022 · 7 comments
Closed
2 tasks done

How to enable path style for s3 services? #390

Xuanwo opened this issue Jan 9, 2022 · 7 comments
Labels
guidance Question that needs advice or information.

Comments

@Xuanwo
Copy link

Xuanwo commented Jan 9, 2022

Update! aws-sdk-s3 >0.52

The AWS SDK for S3 now supports both virtual addressing and path style. By default, virtual addressing will be used if the bucket is DNS compatible. If you do now want to use virtual adressing, use force_path_style(true) when constructing the S3 client.

Note: Loading s3 configuration from the ~/.aws/config is not currently supported.

Prerequisites

Question Description

How to enable path style for s3 compatible service?

For example, to use minio, we need to enable path style so that we can send request to 127.0.0.1:3000/bucket.

Platform/OS/Device

All

Language Version

Rust 1.17.0

@Xuanwo Xuanwo added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Jan 9, 2022
@rcoh
Copy link
Contributor

rcoh commented Jan 9, 2022

currently the SDK will only use path style, I believe. Let me know if you see different behavior.

@Xuanwo
Copy link
Author

Xuanwo commented Jan 9, 2022

Oh, because the deprecation plan of path style, I thought the new sdk will use virtual host api style by default.

Please allow me to correct my question: How to control the api style between virtual host style and path style?

Thanks!

@rcoh
Copy link
Contributor

rcoh commented Jan 10, 2022

currently, the SDK only supports path style. When it is eventually released, it will probably be exposed as a configuration option on the S3 config.

@rcoh rcoh closed this as completed Jan 10, 2022
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@Velfi Velfi removed the needs-triage This issue or PR still needs to be triaged. label Jan 10, 2022
@rossng
Copy link

rossng commented Jan 26, 2023

I just bumped into this issue because the SDK was generating virtual-host style URLs that didn't work with my Minio server. I'm guess that it might be due to this call, which appears to hardcode construction of a virtual-host style URL in some cases. (My server has a hostname like my-machine.local, which triggers whatever logic is deciding here).

@rcoh
Copy link
Contributor

rcoh commented Jan 26, 2023

see this section of the changelog:

Before, all requests hit the path-style endpoint. Going forward, all requests that can be routed to the virtually hosted bucket will be routed there automatically.

force_path_style: Requests will now default to the virtually-hosted endpoint <bucketname>.s3.<region>.amazonaws.com

You want to set force_path_style(true) on aws_sdk_s3::Config during client construction. Here's an example from the S3 tests: https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/s3/tests/endpoints.rs#L36-L43

@rossng
Copy link

rossng commented Jan 26, 2023

Excellent - somehow I missed that on the config object. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

4 participants