巨大なファイルを S3 にアップロードするのが `Part number must be an integer between 1 and 10000, inclusive` のエラーになるときにやったことのメモ。
巨大なファイルを S3 にアップロードするのが Part number must be an integer between 1 and 10000, inclusive
のエラーになるときにやったことをメモしておく。
なにをしたらどんなことがおきるか
100GB くらいのファイルを aws s3 cp
コマンドで S3 にアップロードしたらこんなエラーになった。
An error occurred (InvalidArgument) when calling the UploadPart operation: Part number must be an integer between 1 and 10000, inclusive
$ aws --version
どうしたか
aws s3 cp
の公式ドキュメントを見てみた。
aws s3 cp
の公式ドキュメントは「ストリームを S3 にアップロードしててストリームのサイズが 50GB より大きい場合は ストリームの予想サイズを ----expected-size
オプションに指定しないと失敗することがあるよ」と書いているので、 --expected-size= 107374182400
みたいに --expected-size
を指定したらエラーにならなくなった。
たぶんだけどストリームを S3 にアップロードするときはチャンク数が最大でも 10000 の制限がありそう。 --expected-size
オプションでストリームの予想サイズを指定するとストリームをチャンクに分割するときにチャンク数が 10000 を超えないようにチャンクサイズを決めてそう。
This argument specifies the expected size of a stream in terms of bytes. Note that this argument is needed only when a stream is being uploaded to s3 and the size is larger than 50GB. Failure to include this argument under these conditions may result in a failed upload due to too many parts in upload.