Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Easy way to upload a local text file to sm AwS S3 Bucket
Post Flair (click to view more posts with a particular flair)
Post Body

Easy way to upload a local text file to AWS S3 Bucket using the AWS SDK.

Simple as this really, I've tried copying the examples in the guide but get an error stating it can't convert from std::shared_ptr<aws::fstream> to std::shared_ptr<aws::iostream>

At a loss really as this pretty much seems to be the only way I can find in Google.

Here's my code

const Aws::String& objectName = "file.txt"; Aws::Client::ClientConfiguration clientConfig; clientConfig.scheme = Aws::Http::Scheme::HTTPS; clientConfig.connectTimeoutMs = 30000; clientConfig.requestTimeoutMs = 600000; Aws::S3::S3Client s3_client(clientConfig);

Aws::S3::Model::PutObjectRequest putObjectRequest; putObjectRequest.SetBucket("my-bucket"); putObjectRequest.SetKey("file.txt");

// This next line errors

std::shared_ptr<Aws::IOStream> input_data = Aws::MakeShared<Aws::FStream>("SampleAllocationTag", objectName.c_str(), std::ios_base::in | std::ios_base::binary);

putObjectRequest.SetBody(input_data); Aws::S3::Model::PutObjectOutcome outcome = s3_client.PutObject(putObjectRequest);

And here's the full error

Error C2440 'initializing': cannot convert from 'std::shared_ptr<Aws::FStream>' to 'std::shared_ptr<Aws::IOStream>'

Thanks in advance

Author
Account Strength
70%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,201
Link Karma
74
Comment Karma
1,127
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago