0

I am trying to setup s3cmd to send data to s3 bucket that is configured with object lock, but i am getting below error message.

s3 error: 400 (invalidrequest): content-md5 http header is required for put object requests with object lock parameters

Can somebody help me with it?

madhan
  • 13
  • 4

3 Answers3

0

As you can read at the end note here:

If you configure a default retention period on a bucket, requests to upload objects in such a bucket must include the Content-MD5 header. For more information, see Put Object in the Amazon Simple Storage Service API Reference.

For s3cmd you can use the option:

--add-header=Content-MD5:VALUE

You need to calculate the value somehow, before sending the request.

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
0

You can disable retention with the object lock enabled.

Ping Woo
  • 1,423
  • 15
  • 21
0

Faced this problem today and solved it by adding

-CalculateContentMD5Header $true

I am using AWS Tools for Powershell in this case,

Write-S3Object -BucketName test-files -Key "sample.txt" -File .\local-sample.txt -CalculateContentMD5Header $true

leaving it here in case it helps someone.

furydrive
  • 372
  • 2
  • 5