s3tools / s3cmd

Official s3cmd repo -- Command line tool for managing S3 compatible storage services (including Amazon S3 and CloudFront).

Home Page:https://s3tools.org/s3cmd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`s3cmd du` doesn't support `ap-east-1` region

burmecia opened this issue · comments

When run s3cmd like below to get size of a bucket located in ap-east-1 region, got an error:

$ s3cmd du s3://bucket/dir
ERROR: S3 error: 400 (IllegalLocationConstraintException): The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.

When specified region still got same error:

$ s3cmd --region=ap-east-1 du s3://bucket/dir
ERROR: S3 error: 400 (IllegalLocationConstraintException): The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.

I can see ap-east-1 isn't in the region list:

  --region=REGION, --bucket-location=REGION
                        Region to create bucket in. As of now the regions are:
                        us-east-1, us-west-1, us-west-2, eu-west-1, eu-
                        central-1, ap-northeast-1, ap-southeast-1, ap-
                        southeast-2, sa-east-1

Is it possible to add support for ap-east-1 region? Thanks.

s3cmd version: 2.4.0
OS: macOS 14.1.2

try this in your .s3cfg

bucket_location = ap-east-1
host_base = s3.ap-east-1.amazonaws.com
host_bucket = %(bucket)s.s3.ap-east-1.amazonaws.com

I have done similarly for eu-south-1 region and it works

@burmecia The help has some hint for regions hardcoded, but otherwise we don't have a whitelist and also don't do anything specific per region.

Based on other bug reports, it looks like that ap-east-1 region has a little bit of specific behavior, and so you have to correctly set the host_base and host_bucket with the region.