I have a bucket for which I am trying to upload objects into from a C# SDK application (.Net 4.6.1).
This is my public access block:
PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration()
{
IgnorePublicAcls = false,
RestrictPublicBuckets = false,
BlockPublicPolicy = false,
BlockPublicAcls = false
}
The bucket has this policy applied to it:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect":"Allow",
"Principal": "*",
"Action":[
"s3:*"
],
"Resource":[
"arn:aws:s3:::testbucket2023/*",
"arn:aws:s3:::testbucket2023"
]
}
]
}
Calling code:
var request = new PutObjectRequest()
{
BucketName = @"testbucket2023/testtag",
Key = @"i/file.jpg",
ContentType = contentType,
InputStream = fileData,
CannedACL = S3CannedACL.PublicRead
};
var response = S3Client.PutObject(request);
When I call PutObject, I get this error:
{"The request signature we calculated does not match the signature you provided. Check your key and signing method."}
Inner exception:
{"The remote server returned an error: (403) Forbidden."}
What else do I need to set to make this work? I will lock down the bucket to a specific principal once it is working.
This turned out to be a result of the AWS SDK being very out of date. Specifically, how they handle TLS has changed significantly. Simply upgrading to the latest fixed the error.