AWS S3 putobject with public read permissions - .Net SDK

got my answer in AWS forum @ https://forums.aws.amazon.com/message.jspa?messageID=671223

Re-posting it here for ease:

http://docs.aws.amazon.com/sdkfornet1/latest/apidocs/html/T_Amazon_S3_Model_S3CannedACL.htm

var request = new PutObjectRequest()
{
    BucketName = "some-bucket",
    Key = fileName,
    FilePath = filePath,
    StorageClass = new S3StorageClass("REDUCED_REDUNDANCY"),
    ContentType = "text/csv",
    CannedACL = S3CannedACL.PublicRead
};

This would upload the file, and set it with Public Read permissions.

In case you get "Access Denied" errors, make sure you have "PutObjectAcl" permission in your IAM policy.


I personally landed here while looking for solution using NodeJS SDK v2, if you are also looking for NodeJS solution, here it is:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property

Nodejs SDK v2:

 const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
 const params = {
    Body: buffer,
    Bucket: "bucket-name",
    Key: "image.png",
    ACL: "public-read",  // <--------------------
  };

  s3.putObject(params, function (err, data) {
     // ???
  });

For anyone still searching for an answer, adding the ACL:'public-read' property did the trick.

      s3.putObject({ 
              BucketName = "some-bucket",
              Key = fileName,
              FilePath = filePath,
              ACL:'public-read'
      }