AWS Developer Tools Blog
Introducing S3Link to DynamoDBContext
S3Link has been in the AWS SDK for Java for a while now, and we have decided to introduce it to the AWS SDK for .NET as well. This feature allows you to access your Amazon S3 resources easily through a link in your Amazon DynamoDB data. S3Link can be used with minimal configuration with the .NET DynamoDB Object Persistence Model. To use S3Link, simply add it as a field to your DynamoDB annotated class and create a bucket in S3. The following Book
class has an S3Link property named CoverImage
.
Now that we have an S3Link in our annotated class, we are ready to manage an S3 object. The following code does four things:
- Creates and saves a book to DynamoDB
- Uploads the cover of the book to S3
- Gets a pre-signed URL to the uploaded object
- Loads the book back in using the
Context
object and downloads the cover of the book to a local file
And that’s the general use for S3Link. Simply provide it a bucket and a key, and then you can upload and download your data.