Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to upload files to s3 from aws cli with kms encryption

I want to upload a file from local machine to s3 with kms encryption . I have been using the following command:

    aws s3 cp /filepath s3://mybucket/filename --sse-kms-key-id <key id>

it shows the following error " error occured:when calling the PutObject operation: Server Side Encryption with AWS KMS managed key requires HTTP header x-amz -server-side-encryption : aws:kms" What could possibly be causing this error?

like image 811
vishal Avatar asked Oct 24 '17 04:10

vishal


1 Answers

It looks like you're missing the --sse aws:kms flag. You're likely looking for something like

aws s3 cp /filepath s3://mybucket/filename --sse aws:kms --sse-kms-key-id <key id>

Check out aws s3 cp options for more details.

like image 134
Jamie Starke Avatar answered Oct 07 '22 17:10

Jamie Starke