dynamodb s3 link code example
Example: dynamodb s3 link
// Create a DynamoDBContext
var context = new DynamoDBContext();
// Create a book with an S3Link
Book myBook = new Book
{
Id = 501,
CoverImage = S3Link.Create(context, "myBucketName", "covers/AWSSDK.jpg", Amazon.RegionEndpoint.USWest2),
Title = "AWS SDK for .NET Object Persistence Model Handling Arbitrary Data",
ISBN = 999,
BookAuthors = new List { "Jim", "Steve", "Pavel", "Norm", "Milind" }
};
// Save book to DynamoDB
context.Save(myBook);
// Use S3Link to upload the content to S3
myBook.CoverImage.UploadFrom("path/to/covers/AWSSDK.jpg");
// Get a pre-signed URL for the image
string coverURL = myBook.CoverImage.GetPreSignedURL(DateTime.Now.AddHours(5));
// Load book from DynamoDB
myBook = context.Load(501);
// Download file linked from S3Link
myBook.CoverImage.DownloadTo("path/to/save/cover/otherbook.jpg");