我正在尝试访问 IBM ICOS S3 存储桶来存储 Java 代码中的文件,如下所示。 Bucket和End Point的名称如下
Bucket Name: icos-abc-prod-01-abc-02
Endpoint: https://icos.abc.us-region.internal.pqr
credentials = new BasicAWSCredentials(VAL_ACCESS_KEY_ID, VAL_SECRET_ACCESS_KEY);
if (1==1) {
log.info("Trying to get file system of S3 Compatible.");
S3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
VAL_END_POINT_REGION, "us-east-1"))
.build();
bucketName = VAL_BUCKET_NAME;
}
访问此代码时,我收到错误如下
Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
有人可以帮忙吗?
我不是java程序员,但请看这里:https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-java
我发现端点与您提供的端点不同。
实际:private static String COS_ENDPOINT = ""; // 例如“https://s3.us.cloud-object-storage.appdomain.cloud”
您的:端点:https://icos.abc.us-region.internal.pqr
提供的示例适用于驻留在并分布在 us-east、us-south 等地区的“跨区域”端点。您可以在此处找到所有可能的端点:https://cloud.ibm.com/docs/ cloud-object-storage?topic=cloud-object-storage-endpoints 名称与“弹性”类型和位置匹配。