首页 > 解决方案 > IBM Cloud COS:使用 S3 API get-bucket-location 返回未找到存储桶

问题描述

我正在为 IBM Cloud COS 使用 S3 API,并且从 get-bucket-location 收到意外的 bucket not found 错误。

我的存储桶存在于 us-south 区域并显示 s3 ls 命令,但获取该区域失败。我正在使用 java AWS api,但可以使用 aws cli 重现它。

[08:07] jwilliams:~ $ aws --profile ibm --endpoint-url https://s3-api.us-geo.objectstorage.softlayer.net s3api get-bucket-location --bucket s3-wzd-dv-integrationtest-so-1

An error occurred (NoSuchBucket) when calling the GetBucketLocation operation: The specified bucket does not exist.

[08:07] jwilliams:~ $ aws  --profile ibm --endpoint-url https://s3-api.us-geo.objectstorage.softlayer.net s3 ls
2018-12-05 10:06:00 s3-wzd-dv-integrationtest-ea-1
2018-12-05 10:04:51 s3-wzd-dv-integrationtest-so-1
2018-11-29 15:59:19 wzd-jw-bucket-1
2018-11-29 16:14:55 wzd-jw-bucket-2

标签: ibm-cloudobject-storage

解决方案


当您创建“区域”存储桶而不是“跨区域”时,会发生此类错误。您可以从 IBM Cloud 控制台验证存储桶的位置。Bucket -> Configuration 还会为您提供可以使用的公共 URL。

根据地区,试试这些:

aws  --profile ibm --endpoint-url https://s3.us-east.objectstorage.softlayer.net s3 ls

aws  --profile ibm --endpoint-url https://s3.us-south.objectstorage.softlayer.net s3 ls

推荐阅读