Posting files from .NET to Amazon S3

By | 27 July, 2014

When you’re dealing with files and your website makes it possible to users to upload photos, videos or any other kind of files, it can be useful to store them up in the Cloud instead of in your current Server Distributed File System. This is a good choice especially when you don’t own the specific Server and you have limited storage space quota as well.

Amazon S3 comes with a free plan which includes 5 GB of storage space for free. In case you need to extend it in near future, you can pay as you need more resources.

Interacting with Amazon API is pretty simple thanks to the different SDKs they’ve released. There’s almost one for each relevant programming language. For .NET you can download it from this link:

We can go a bit further and see how this can be done in C#. Assuming that we have an account in Amazon and we have written down our API Key, we just need to download the SDK, import the DLL in our project and write a piece of code similar to this:

Recently this option was implemented to post photos in a website I’ve published in AppHarbor ( Given this platform deletes all the resources of your local File System, you cannot store anything you want to keep from one deployment to the following. Thus in this scenario Amazon S3 is a very convenient solution:

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Leave a Reply

Your email address will not be published.