I am trying to write a lambda function to upload file to S3 using PutObject with checksum. However I am getting the error Unknown parameter in input ChecksumAlgorithm
"errorMessage": "Parameter validation failed:\nUnknown parameter in input: \"ChecksumAlgorithm\", must be one of: ACL, Body, Bucket, CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentLength, ContentMD5, ContentType, Expires, GrantFullControl, GrantRead, GrantReadACP, GrantWriteACP, Key, Metadata, ServerSideEncryption, StorageClass, WebsiteRedirectLocation, SSECustomerAlgorithm, SSECustomerKey, SSECustomerKeyMD5, SSEKMSKeyId, SSEKMSEncryptionContext, BucketKeyEnabled, RequestPayer, Tagging, ObjectLockMode, ObjectLockRetainUntilDate, ObjectLockLegalHoldStatus, ExpectedBucketOwner",
Code is below:
import boto3
s3_conn=boto3.client('s3')
bucket_name="test123"
def lambda_handler(event, context):
filename="./sample.txt"
with open(filename, 'rb') as file:
response = s3_conn.put_object(
Bucket=bucket_name,
Key='Test.txt',
Body=filename,
ChecksumAlgorithm='SHA1'
)
print(response)
As per boto3 documentation ChecksumAlgorithm is part of the S3 PutObject