If you’re ever using the AWS C++ SDK in some constrained environment (such as Lambda functions with limited memory) or care about memory copies, you probably run into the issue of how to upload an existing buffer without copying it (as other developers did). You can write your own streambuf wrapper to do so, but if you’re already using boost in your project, boost::interprocess::bufferstream is a very straightforward way to do it:

char* buf;
std::size_t len;
const std::shared_ptr<Aws::IOStream> data = Aws::MakeShared<boost::interprocess::bufferstream>(TAG, buf, buf_len);

data can then be used as usual:

Aws::S3::Model::PutObjectRequest request;
request.WithBucket(bucket_name).WithKey(name);
request.SetBody(data);
auto outcome = client->PutObject(request);