1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

S3に配置したファイルのハッシュ値チェックを行う

1
Last updated at Posted at 2026-04-06

TL;DR

s3 cpコマンドの、ダウンロード先のパスに、-(ハイフン)
を指定すると、ダウンロードせずに標準出力に流して、パイプを使ってハッシュ値チェックだけできる。

これはposixの慣習で、tarなど他のコマンドでも使える。

モジュールの手動配置

モジュールの手動配置対応があった場合に、正しくアップロードできているかを確認する必要があります。

モジュールの多くは、公式のダウンロードページにモジュールのハッシュ値があるので、それと比較することで、正しくアップロードできていることを担保します。

関連記事

様々な理由で正しくアップロードできない可能性もあるのでチェックが必要です。
macbookのFinderで開いてしまって、

__MACOSX

といった、
隠しファイルが混在してしまうなどもありえます。

これ

aws s3 cp s3://XXXXXXXXXXX/XX.XX.X.0.0/XXXXX/pXXXXXX_XXXXXXX.zip - --profile XXXX | sha256sum

何が良いか

  • ダウンロードせずにチェックできる。

geminiの解説

最後にある -(ハイフン)がポイントです。これは「ファイルに保存する代わりに、内容を標準出力(画面や次の処理への渡し口)に流す」という指定です。

  • ハッシュ値だけが、コマンドラインに表示されて見やすい。

これは基礎知識

標準出力とは

他のコマンドでも使える。

コマンド 意味
tar tar -cvf - dir/ 固めたデータをファイルではなく標準出力に流す
curl curl -o - URL ダウンロードした中身を標準出力に流す
kubectl kubectl apply -f - ファイルからではなく、標準入力から設定を読み込む

Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -.

以上

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?