我一直在查看Amazon S3服务的使用情况报告,发现对GetObject操作收取DataTransfer-out-bytes费用(好的,我理解这一点),对HeadBucket操作收取DataTransfer-out-bytes费用。

什么是HeadBucket,何时发出此请求?

干杯

最佳答案

这是对存储桶的HEAD请求:

HEAD /my-s3-bucket

基本上,这只会告诉您是否存在存储桶(200 OK),或者不存在(404未找到)。

例如:
# curl -v -X HEAD http://s3.amazonaws.com/fooXXXX

* About to connect() to s3.amazonaws.com port 80 (#0)
*   Trying 72.21.211.144... connected
* Connected to s3.amazonaws.com (72.21.211.144) port 80 (#0)
> HEAD /fooXXXX HTTP/1.1
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10
> Host: s3.amazonaws.com
> Accept: */*
>
< HTTP/1.1 404 Not Found
< x-amz-request-id: A21BF750F080A267
< x-amz-id-2: SPQ7yX6Ln0Zgp0YULT/64ag9077nNnN25jH8PMLGMm/SbXPZ+FF3qFuiOyBfiktP
< Content-Type: application/xml
< Transfer-Encoding: chunked
< Date: Thu, 23 Apr 2009 13:39:50 GMT
< Server: AmazonS3

VS.
# curl -v -X HEAD http://s3.amazonaws.com/s3hub

* About to connect() to s3.amazonaws.com port 80 (#0)
*   Trying 72.21.207.135... connected
* Connected to s3.amazonaws.com (72.21.207.135) port 80 (#0)
> HEAD /s3hub HTTP/1.1
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10
> Host: s3.amazonaws.com
> Accept: */*
>
< HTTP/1.1 200 OK
< x-amz-id-2: E6OvrEMD35HpJjlBg0kB90H/uaQDX8qk0oXb+baOtDKIoMXmNwgIRSX2rDE5Urlb
< x-amz-request-id: DAAAA11524A4A557
< Date: Thu, 23 Apr 2009 13:43:01 GMT
< Content-Type: application/xml
< Transfer-Encoding: chunked
< Server: AmazonS3
<

10-08 20:06