Adding item to AWS S3 Bucket

string accessKey = "KEY HERE";
string secretKey = "KEY HERE";
AmazonS3 client;
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey))
{
var stream = new System.IO.MemoryStream();
originalBMP.Save(stream, ImageFormat.Bmp);
stream.Position = 0;

PutObjectRequest request = new PutObjectRequest();
request.InpuStream = stream;
request.BucketName="MyBucket";
request.CannedACL = S3CannedACL.PublicRead;
request.Key = "images/" + filename;  //unique identifier
S3Response response = client.PutObject(request);
}

Refer to Building URL point to object in AWS S3 Bucket on how to retrieve the object in AWS S3 Bucket.

Advertisements
This entry was posted in AWS and tagged , , . Bookmark the permalink.

2 Responses to Adding item to AWS S3 Bucket

  1. Pingback: Building URL point to object in AWS S3 Bucket | TechCentral

  2. In a later comment, I would love to run through some of the reasoning behind our choices.

    Quality reasoning here. I always benefit from going through your posts.
    I’ve learned a lot from them.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s