I'm attempting to use this documentation to upload a file to my S3 bucket using the AWS SDK. Unfortunately, there does not seem to be any documentation giving an example of how to do this in .NET Core, only how to create and inject an instance of IAmazonS3.
Here is what I have:
private IAmazonS3 client; //Being injected
private string bucketName;
using (client)
{
var request = new PutObjectRequest
{
BucketName = bucketName,
Key = "keyTest",
ContentBody = "sample text"
};
var response = await client.PutObjectAsync(request);
}
When it calls the PutObjectAsync() line, it hangs for 30 seconds or so and then throws a "The HTTP redirect request failed" exception.
All the documentation I'm seeing is for PutObject() not PutObjectAsync(). The client instance I have only exposes async methods.
Brutal. I had my IAmazonS3 client pointing at us-west-1, but it was a different region (us-west-2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With