首页 > 解决方案 > 110MB 文件的 S3 ETag 不是 MD5

问题描述

我对 ETag 的理解是它应该对应于 MD5 哈希,前提是您没有使用分段上传并且没有使用 KMS 加密。

我刚开始依赖应用程序中的这个功能,发现这不成立。

我通过 cli 上传了一个较大的 powerpoint 文件(110MB),而 ETag 不是 MD5 哈希。

使用与较小的 powerpoint 文件完全相同的 cli 命令,并且 ETag 是 MD5 哈希。

通过控制台观察到相同的行为。cli和控制台是在后台使用分段上传还是我错过了其他东西?


jgreenal$ aws s3 cp bigpowerpoint.pptx s3://mybucketname --sse=AES256

jgreenal$ aws s3api head-object --bucket mybucketname --key bigpowerpoint.pptx
{
    "AcceptRanges": "bytes",
    "LastModified": "Fri, 06 Mar 2020 11:15:47 GMT",
    "ContentLength": 113962008,
    "ETag": "\"d15e9a175cd9365a6480eab9105c7c86-14\"",
    "VersionId": "2JMq2pPyKMk3ZlSco4l.r5ZPip_pp6Oq",
    "ContentType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    "ServerSideEncryption": "AES256",
    "Metadata": {},
    "ReplicationStatus": "COMPLETED"
}

jgreenal$ aws s3 cp tinypowerpoint.pptx s3://mybucketname --sse=AES256

jgreenal$ aws s3api head-object --bucket mybucketname --key tinypowerpoint.pptx
{
    "AcceptRanges": "bytes",
    "LastModified": "Fri, 06 Mar 2020 11:20:37 GMT",
    "ContentLength": 33878,
    "ETag": "\"7a0b3c27805d5f599e5d655b13b4644c\"",
    "VersionId": "Tv1WyDSoHo2s.p59IKM_M6iaVGdh6EiF",
    "ContentType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    "ServerSideEncryption": "AES256",
    "Metadata": {},
    "ReplicationStatus": "COMPLETED"
}

标签: amazon-s3

解决方案


抱歉——这个问题的答案已经在我的问题中了——应该先更深入地检查一下。

aws s3 cp确实在后台使用了分段上传。

jgreenal$ aws s3api put-object  --bucket my-bucketname --key bigpowerpointput.pptx --body bigpowerpoint.pptx --server-side-encryption AES256
jgreenal$ aws s3api head-object --bucket my-bucketname --key bigpowerpointput.pptx
{
    "AcceptRanges": "bytes",
    "LastModified": "Fri, 06 Mar 2020 11:43:21 GMT",
    "ContentLength": 113962008,
    "ETag": "\"a11619dc992b584587c24668c767a46c\"",
    "VersionId": "DYG.5IOkbJncwCT6iOK5c2seKBtDTg_7",
    "ContentType": "binary/octet-stream",
    "ServerSideEncryption": "AES256",
    "Metadata": {},
    "ReplicationStatus": "COMPLETED"
}

推荐阅读