Skip to content

Conversation

@sbiscigl
Copy link
Contributor

Description of changes:

Adds a client configuration for the buffer that is used to encode aws-chunked content encoded messages. This is extremely useful when running in a memory restricted enviornment and this needs to be smaller than the default 64KiB

example usage

#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/PutObjectRequest.h>

#include <fstream>

using namespace Aws;
using namespace Aws::S3;
using namespace Aws::S3::Model;
using namespace Aws::Utils;
using namespace Aws::Utils::Logging;

class sdk_context_context {
 public:
  sdk_context_context(SDKOptions&& options) : options_{std::move(options)} {
    InitAPI(options_);
  }
  ~sdk_context_context() { ShutdownAPI(options_); }

 private:
  SDKOptions options_;
};

auto main() -> int {
  SDKOptions options{};
  options.loggingOptions.logLevel = LogLevel::Debug;
  sdk_context_context context{std::move(options)};

  S3ClientConfiguration configuration{};
  // set to 12 KiB
  configuration.awsChunkedBufferSize = 1024 * 12;
  const S3Client client{configuration};
  auto request = PutObjectRequest{}
                     .WithBucket("bucket")
                     .WithKey("key");
  request.SetBody(Aws::MakeShared<Aws::FStream>(
      "allocation-tag",
      "/some/file/path",
      std::ios_base::in | std::ios_base::out));
  const auto result = client.PutObject(request);
  if (!result.IsSuccess()) {
    std::cout << "Failed to upload file: " << result.GetError().GetMessage()
              << std::endl;
  }
  return 0;
}

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbiscigl sbiscigl marked this pull request as ready for review January 23, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants