So Su Team : Web Development Tags : Web Development

Using the AWS SDK to create an S3 connector

So Su Team : Web Development Tags : Web Development

I was looking for a file manager plugin for CKEditor or TinyMCE with S3 support. There was nothing decent available. Well, nothing in the .NET space anyway, it was all in PHP, even the licensed file managers. So I decided to write my own. I was already using CKEditor with Core Five Labs’ file manager, so all that was needed was to create an S3 connector for it.

Upon examining the AWS SDK, the first thing you notice is the similarities between System.IO namespace and the classes in the SDK. For instance

var dirInfo = new S3DirectoryInfo(_awsClient, _bucketName, path);

            var dirInfo = new DirectoryInfo(path); 

The S3DirectoryInfo object has an equivalent of the well know GetFiles/ GetDirectories method found on the System.IO objects. Obviously it’s not a 1:1 mapping against the two frameworks, for instance, the AWS doesn’t have a Created Date for its files/directories. There are enough similarities though for migration to be an intuitive process, there wasn’t a need to look up the documentation at all. In the end, my S3 connector centred on the use of 2 classes from the AWS SDK:

S3FileInfo

S3DirectoryInfo

I would say the AWS SDK makes interacting with S3 a walk in the park with an intuitive migration path from .NET’s System.IO to AWS SDK. It even comes in NuGet form!