LoginSignup
2
0

More than 3 years have passed since last update.

AWS S3のETagにファイル名は関係ない

Posted at

概要

AWS S3のETagはファイル内容のmd5ハッシュ値であるため,ファイルの内容が同一かどうかを簡単に確認することができます.

ところで,ファイル名が異なるとETagの値は異なるのでしょうか?
ファイル内容に対するハッシュ値なのでファイル名は関係しないと思いますが,実際どうなのか確認しました.

結論

ETagの値にファイル名は関係ありません.

ファイル内容に対するハッシュ値なのでファイル名は関係ありませんでした.念の為確認できて安心しました.

調査方法

$ echo "Hello World" >> test1.txt
$ cp test1.txt test2.txt
$ aws s3 cp ./test1.txt s3://<S3バケット名>
$ aws s3 cp ./test2.txt s3://<S3バケット名>
$ aws s3api list-objects-v2 --bucket <S3バケット名>
{
    "Contents": [
        {
            "LastModified": "2019-06-30T08:42:47.000Z",
            "ETag": "\"e59ff97941044f85df5297e1c302d260\"",
            "StorageClass": "STANDARD",
            "Key": "test1.txt",
            "Size": 12
        },
        {
            "LastModified": "2019-06-30T08:42:51.000Z",
            "ETag": "\"e59ff97941044f85df5297e1c302d260\"",
            "StorageClass": "STANDARD",
            "Key": "test2.txt",
            "Size": 12
        }
    ]
}

$ md5 test1.txt
MD5 (test1.txt) = e59ff97941044f85df5297e1c302d260
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0