调用CreateBucket操作时发生错误(IllegalLocationConstraintException)

时间:2019-10-04 23:25:54

标签: amazon-web-services amazon-s3

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

$ 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 个答案:

答案 0 :(得分:2)

两个可能的修复程序:

使用s3命令:

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

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

  

us-east-1以外的地区需要适当的   要在中创建存储区时要指定LocationConstraint   所需区域

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