Comment 1 for bug 1611749

Revision history for this message
Tim Burke (1-tim-z) wrote :

This seems like a bug in ec2-ami-tools. CreateBucketConfiguration is what's documented for the API [1] as well as what other clients use [2] [3] [4].

And yet, sure enough, AWS accepts CreateBucketConstraint:

  > PUT / HTTP/1.1
  > Host: b349581c95cb0fa4.s3.amazonaws.com
  > Accept: application/json;q=1, text/*;q=.9, */*;q=.8
  > x-amz-date: Wed, 28 Dec 2016 16:12:43 -0800
  > Authorization: AWS AKIAINX36BBVRCISCYCA:lnKWPdY6Px8HmZ/Fl77AVkyXEpM=
  > Content-Length: 99
  >
  * upload completely sent off: 99 out of 99 bytes
  < HTTP/1.1 200 OK
  < x-amz-id-2: 5+5eNAdV8xJnbhPCFqZxSiSCsSnexQXyf7M8zcHTKXcGqEJbmrnY6eCGtiJF+x1h59c4BLxd+5Y=
  < x-amz-request-id: D5D78288796C428A
  < Date: Thu, 29 Dec 2016 00:12:45 GMT
  < Location: http://b349581c95cb0fa4.s3.amazonaws.com/
  < Content-Length: 0
  < Server: AmazonS3
  <

  > GET / HTTP/1.1
  > Host: b349581c95cb0fa4.s3.amazonaws.com
  > Accept: application/json;q=1, text/*;q=.9, */*;q=.8
  > x-amz-date: Wed, 28 Dec 2016 16:12:44 -0800
  > Authorization: AWS AKIAINX36BBVRCISCYCA:glfdAWag+2XC50DTE4Az8JwVeNs=
  > Content-Length: 99
  >
  * upload completely sent off: 99 out of 99 bytes
  < HTTP/1.1 307 Temporary Redirect
  < x-amz-bucket-region: us-west-1
  < x-amz-request-id: C04BDC83F73C85CA
  < x-amz-id-2: xJR/BGFKs6h+R0IJiK8pSxC9l6TBIXl345rfCz3k9eJc/EEubf9qijEn48gFY1WGKrJnXKaXRSA=
  < Location: https://b349581c95cb0fa4.s3-us-west-1.amazonaws.com/
  < Content-Type: application/xml
  < Transfer-Encoding: chunked
  < Date: Thu, 29 Dec 2016 00:12:44 GMT
  < Connection: close
  < Server: AmazonS3
  <

In fact, it even accepts junk data, like "<foo><LocationConstraint>us-west-1</LocationConstraint></foo>":

  > PUT / HTTP/1.1
  > Host: b349581c95cb0fa6.s3.amazonaws.com
  > Accept: application/json;q=1, text/*;q=.9, */*;q=.8
  > x-amz-date: Wed, 28 Dec 2016 16:22:25 -0800
  > Authorization: AWS AKIAINX36BBVRCISCYCA:jjyByg8+HCGGktvrgmrXcKEXzMg=
  > Content-Length: 61
  >
  * upload completely sent off: 61 out of 61 bytes
  < HTTP/1.1 200 OK
  < x-amz-id-2: V+K/bmU3we/NAckK4w6BMdh7VRdP8Mx0nEMLbLvHHzqcHyica8qPI20tGZ/qqb+5zQsVmxZcZ2A=
  < x-amz-request-id: B2AEBF2ECA183277
  < Date: Thu, 29 Dec 2016 00:22:27 GMT
  < Location: http://b349581c95cb0fa6.s3.amazonaws.com/
  < Content-Length: 0
  < Server: AmazonS3
  <

  > GET / HTTP/1.1
  > Host: b349581c95cb0fa6.s3.amazonaws.com
  > Accept: application/json;q=1, text/*;q=.9, */*;q=.8
  > x-amz-date: Wed, 28 Dec 2016 16:22:26 -0800
  > Authorization: AWS AKIAINX36BBVRCISCYCA:au7fUHeGythnpzCs81437xzamE8=
  >
  < HTTP/1.1 307 Temporary Redirect
  < x-amz-bucket-region: us-west-1
  < x-amz-request-id: 21B3CABC0401A6A0
  < x-amz-id-2: W5NjXbClam0N1p4S0S8M3XfWtL4nOkMV3tMsNOAgfrrbPTEiIhIMYW+NMHNQ0g9OpcmYFxYNmYg=
  < Location: https://b349581c95cb0fa6.s3-us-west-1.amazonaws.com/
  < Content-Type: application/xml
  < Transfer-Encoding: chunked
  < Date: Thu, 29 Dec 2016 00:22:26 GMT
  < Server: AmazonS3
  <

Going stranger than that, like "<foo><bar>us-west-1</bar></foo>", thankfully *is* rejected:

  > PUT / HTTP/1.1
  > Host: b349581c95cb0fa7.s3-us-west-1.amazonaws.com
  > Accept: application/json;q=1, text/*;q=.9, */*;q=.8
  > x-amz-date: Wed, 28 Dec 2016 16:24:46 -0800
  > Authorization: AWS AKIAINX36BBVRCISCYCA:/h2HLNERYCU7DIv/zWxmkV4y/WI=
  > Content-Length: 31
  >
  * upload completely sent off: 31 out of 31 bytes
  < HTTP/1.1 400 Bad Request
  < x-amz-request-id: BB96CF1EF1149D2D
  < x-amz-id-2: AhYFLmBubCCf/BHtqJ09kJAYw54k8j6t60K4Oe9Hx5tBnaTJpR/uTnDsf+LoHkEthxPVXz2C1qc=
  < Content-Type: application/xml
  < Transfer-Encoding: chunked
  < Date: Thu, 29 Dec 2016 00:24:46 GMT
  < Connection: close
  < Server: AmazonS3
  <
  <?xml version="1.0" encoding="UTF-8"?>
  <Error><Code>MalformedXML</Code><Message>The XML you provided was not well-formed or did not validate against our published schema</Message><RequestId>BB96CF1EF1149D2D</RequestId><HostId>AhYFLmBubCCf/BHtqJ09kJAYw54k8j6t60K4Oe9Hx5tBnaTJpR/uTnDsf+LoHkEthxPVXz2C1qc=</HostId></Error>

[1] http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html
[2] https://github.com/boto/boto/blob/2.45.0/boto/s3/connection.py#L613
[3] https://github.com/s3tools/s3cmd/blob/v1.6.1/S3/S3.py#L356
[4] https://github.com/aws/aws-sdk-java/blob/1.11.73/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L991