Medical physicist Medical physicist - 4 months ago 34
C++ Question

AWS SDK C++: putting an object in S3 with server side encryption

It's very easy to select server side encryption in S3 when putting an object with the AWS SDK PHP:

$result = $client->putObject(array(
'Bucket' => $bucket,
'Key' => $key,
'SourceFile' => $source_file,
'ServerSideEncryption' => 'AES256'

Putting an object in S3 with the AWS SDK C++ looks similar to:

Aws::S3::Model::PutObjectRequest object_request;
auto input_data = Aws::MakeShared<Aws::FStream>(key_name.c_str(), dir_name.c_str(), std::ios_base::in);
auto put_object_outcome = s3_client.PutObject(object_request);

But, how can you select server side encryption with the AWS SDK C++?


Ok, I found the solution: