5
votes

i have created an S3 bucket and assigned SSE bucket policy(server side encryption with Amazon S3-managed keys ) to it via cloud formation. how to upload an object to S3 bucket via AWS cli with x-aws-server-side-encryption set on the object? An example would be much appreciated.

1

1 Answers

11
votes

You don't mention what tool or SDK you are using to interact with S3. To use the AWS CLI tool to copy a file to S3 with the server-side-encryption flag set:

aws s3 cp <local path> <s3 path> --sse AES256

There are other -sse options you can use to specify other encryption keys such as KMS keys.