Configure path-style in Java SDK Amazon S3

后端 未结 3 1408
一生所求
一生所求 2021-01-04 11:45

I\'m using AWS Java SDK provided by Amazon to interact with the S3 service.

It seems that by default, the SDK uses virtual-host-style for buckets (i.e. buckets are r

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 12:22

    There's no way to force V1 (path-style) bucket addressing using the Java SDK. The only exception is when your bucket name isn't DNS addressable, in which case the SDK will automatically use V1 addressing. This happens, e.g., when your bucket name contains a period (which is discouraged for this reason).

    If you want this functionality, you'll have to modify the AmazonS3Client class to allow it.

    https://github.com/amazonwebservices/aws-sdk-for-java/

    However, I'm not sure I believe your claim that you "need" to use V1 bucket addressing. The SDK already handles all cases where V1 addressing is necessary -- or if you have found a case where it doesn't, please let us know in the forums.

    https://forums.aws.amazon.com/forum.jspa?forumID=70

提交回复
热议问题