代码之家  ›  专栏  ›  技术社区  ›  Michael Durrant

调用createBucket操作时出错(IllegallocationConstraintException)

  •  0
  • Michael Durrant  · 技术社区  · 5 年前

    使用aws api,我可以在us-east-1中创建一个bucket,但不能在其他地区创建,这是为什么?

    $ aws s3api create-bucket --bucket snap2web-12 --region us-east-1
    {
        "Location": "/snap2web-12"
    }
    19:21:27 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
    $ aws s3api create-bucket --bucket snap2web-13 --region us-east-2
    
    An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
    19:21:44 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
    $ aws s3api create-bucket --bucket snap2web-14 --region us-west-1
    
    An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
    19:23:19 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
    $
    
    1 回复  |  直到 5 年前
        1
  •  2
  •   stdunbar    5 年前

    两种可能的解决方案:

    使用 s3 命令:

    aws s3 mb s3://snap2web-13 --region us-east-2
    

    或者,根据 the s3api examples (强调我的):

    US-East-1以外的地区需要 为创建bucket-in指定的locationconstraint 所需区域 以下内容:

    aws s3api create-bucket --bucket snap2web-13 --region us-east-2 --create-bucket-configuration LocationConstraint=us-east-2