3

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.

1 Answer 1

6

Brutal. I had my IAmazonS3 client pointing at us-west-1, but it was a different region (us-west-2).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.