5

I have a text file on my amazon s3 bucket and I want to write some text at the end of that file. Something like following : xxxxxx|xxxxxx|xxxxx|xxxx. I want to do this with c#. I did tried using streamwriter but it did not worked.

using(StreamWriter writer = new StreamWriter(Server.MapPath(url), true))
{
  writer.WriteLine("xxxxxxxx|xxxxxxxxxxx|xxxxxxx|xxxxxxxxxx");
}

My initial guess is that there must be some kind of authentication requirements. Can anyone help me out or direct to appropriate resources.

slonkar
  • 4,055
  • 8
  • 39
  • 63

1 Answers1

9

Amazon S3 doesn't support appending to objects. You would have to read the entire object from S3, then put it back again with the new data.

The AWS SDK for .NET (See http://aws.amazon.com/sdkfornet ) provides tools that will make authenticated S3 operations easier to manage in C#, including treating S3 buckets like a local filesystem (See http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/html/N_Amazon_S3_IO.htm)

Jim Flanagan
  • 2,129
  • 15
  • 19
  • Thanks Jim for resources but I am using Mac and Unity3D so I guess I wont be able to use the AWS SDK for .net . – slonkar Nov 02 '12 at 22:30