Replies: 2 comments
-
The documentation link you have there is specific to the CLI -- other SDKs to my knowledge, including Go v2 (and excluding botocore because that's what the CLI itself uses) do not support the The Go v2 SDK does support this behavior though, you can enable it in client config: client := s3.NewFromConfig(cfg, func (o *s3.Options) {
o.UsePathStyle = true
}) |
Beta Was this translation helpful? Give feedback.
-
We just hit this, while a little more nuanced - Thought I would share my experience. Our config was set as follows (where bucket and region are injected in):
Our v1 config was set as following: cfg := aws.NewConfig().
WithCredentials(credentials.NewEnvCredentials()).
WithEndpoint("https://{Bucket}.s3.{Region}.amazonaws.com").
WithS3ForcePathStyle(true) The v2 SDK appears to prune the endpoint URI if it matches the bucket. We found we were able to upload and pull new files, but our existing files created with the v1 SDK were returning 404s. The files were being stored in the root of the bucket instead of a subfolder. Digging into the code, we noticed that the API request path template string for every request was Leading to full request URIs resolving as:
I couldn't find anything in the migration docs about the endpoint pruning. For V1 examples in terms :
|
Beta Was this translation helpful? Give feedback.
-
Acknowledgements
go get -u github.com/aws/aws-sdk-go-v2/...
)Describe the bug
Let's assume bar.example.com is an S3 base endpoint that contains a bucket called foo. I can make requests against the bar bucket using virtual-style addressing at foo.bar.example.com, or by using path-style addressing at bar.example.com/foo. When I search for "S3 Custom command settings" on this page I see that I can switch between the two by setting
This does not seem to work for the Go SDK.
Moreover, when set to
auto
, both the AWS CLI and boto3 are smart enough to figure out that they need to use path-style addressing because virtual-style addressing results in hitting a domain with a self-signed cert (the provider I'm using, which is a popular 3rd party, does not have a wildcard cert for their buckets). The Go SDK is unique in that it just fails with an invalid cert error.Expected Behavior
I would expect the Go SDK to behave like boto3 and the AWS CLI. If you do a good job of fixing this issue, maybe AWS will let you rewrite the CLI in Go and then it can be fast.
Current Behavior
Not only does it not use path-style addressing when set to
auto
, it refuses to use path-style addressing when explicitly configured to use path-style addressing.Reproduction Steps
I'm getting an error in this example because of the self-signed cert, but you'll have the same problem with S3 if you wireshark your network traffic.
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.22.1 linux/amd64
Operating System and version
6.8.1-arch1-1
Beta Was this translation helpful? Give feedback.
All reactions