Medical physicist Medical physicist - 2 years ago 217
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++?

Answer Source

Ok, I found the solution:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download