How to pass 'Content-MD5' to request header in Write-S3Object command (powershell)

0

Hello,

I'm looking for a way to pass to the request MD5 hash. I'm using "Write-S3Object" PowerShell command, and I want to upload file to S3 only if the MD5 checksum is valid. I calculate the MD5 checksum based on the following article: https://repost.aws/knowledge-center/data-integrity-s3

BR, Chris

cris
질문됨 일 년 전306회 조회
1개 답변
0

You can allow cmdlet to compute this itself, via the -CalculateContentMD5Header <Boolean> option, which will generate the header based on your content, and include this with the request. S3 will validate this header as part of the PutObject operation.

If you want to pass a manually or precomputed value, set the above to false and pass the header as a custom header.

 -HeaderCollection @{ 'Content-MD5' = 'asdfasdfasdfsa'}

Again, S3 will compare this to the uploaded object after receiving the content. If the MD5 does not match the value S3 computes for the received content, the upload will fail.

profile pictureAWS
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠