79402491

Date: 2025-01-31 10:49:51
Score: 0.5
Natty:
Report link

For anyone who may be encountering the same problem, the solution was simple:

  1. Set your region parameter for Aws::S3::S3Client to containg smart in the end, e.g. us-south-smart.

  2. Set the location constraint using Aws::S3::Model::BucketLocationConstraintMapper to match the region. Corrected code:

    Aws::S3::Model::CreateBucketRequest request; request.SetBucket(bucket); Aws::S3::Model::CreateBucketConfiguration bucketConfig; bucketConfig.SetLocationConstraint(Aws::S3::Model::BucketLocationConstraintMapper::GetBucketLocationConstraintForName(region));//this is the key request.SetCreateBucketConfiguration(bucketConfig); const auto crtOutcome = client.CreateBucket(request); if (crtOutcome.IsSuccess()) { std::cout << "created bucket" << std::endl; }else { std::cout << crtOutcome.GetError().GetMessage() << std::endl; }

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Leonard Betts