1

我试过类似的东西:

Aws::Client::ClientConfiguration config;
config.endpointOverride = Aws::String("localhost:9000");

这没用。

AWS-SDK-CPP 似乎默认使用虚拟主机:

https://bucket-name/s3.amazonaws.com

但是,要访问 Minio,我们需要路径样式访问:

https://localhost:9000/minio/bucket-name

在 AWS-SDK-JAVA 中,有:

AmazonS3ClientBuilder.withPathStyleAccessEnabled(true)

AWS-SDK-CPP 中有类似的东西吗?

4

1 回答 1

3

路径样式和虚拟主机之间的切换在 S3Client 构造函数中:

S3Client(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration(), bool signPayloads = false, bool useVirtualAdressing = true);

将其关闭,如下所示:

Aws::Client::ClientConfiguration config;
config.endpointOverride = Aws::String("172.31.30.127:9000");
config.scheme = Aws::Http::Scheme::HTTP;
auto client = Aws::MakeShared<S3Client>("sample_s3_client", config, false, false);
于 2017-11-08T02:00:04.213 回答