S3 Multipart Upload with SSE-KMS

余生长醉 提交于 2019-12-01 01:44:22

Finally, I am able to find the solution for this. It can be done by setting headers to InitiateMultipartUploadRequest object as follow:

InitiateMultipartUploadRequest initRequest = new
                InitiateMultipartUploadRequest(bucketName, keyName);
        initRequest.putCustomRequestHeader("x-amz-server-side-encryption", "aws:kms");
        initRequest.putCustomRequestHeader("x-amz-server-side-encryption-aws-kms-key-id", kmsKey);

Can also be done like this:

InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest("example-bucket", "textfile.txt");      SSEAwsKeyManagementParams kms = new SSEAwsKeyManagementParams("KMS-key-alias");
initRequest.setSSEAwsKeyManagementParams(kms);
initResponse = s3Client.initiateMultipartUpload(initRequest);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!