Release: AWS SDK for .NET 1.4.0

Release Notes>.NET>Release: AWS SDK for .NET 1.4.0
This release adds Amazon DynamoDB support, updates ActionIdentifier constants, and updates Amazon SNS to give additional control over the content and delivery of messages.


Submitted By: Pavel@AWS
Release Date: January 18, 2012 12:26 PM GMT
Created On: January 18, 2012 12:26 PM GMT
Last Updated: January 18, 2012 12:26 PM GMT


Download the latest AWS SDK for .NET

New Features

Change Description
Amazon DynamoDB

This release add support for Amazon DynamoDB. Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. Customers can easily launch a new Amazon DynamoDB database table, scale up or down their request capacity for the table without downtime or performance degradation, and gain visibility into resource utilization and performance metrics. Amazon DynamoDB enables customers to offload the administrative burdens of operating and scaling distributed databases to AWS, so they don.t have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling.

Amazon DynamoDB is designed to address the core problems of database management, performance, scalability, and reliability. Developers can create a database table that can store and retrieve any amount of data, and serve any level of request traffic. DynamoDB automatically spreads the data and traffic for the table over a sufficient number of servers to handle the request capacity specified by the customer and the amount of data stored, while maintaining consistent, fast performance. All data items are stored on Solid State Disks (SSDs) and are automatically replicated across multiple Availability Zones in a Region to provide built-in high availability and data durability.

In addition to basic service API, the AWS SDK for .NET includes two helper namespaces and corresponding classes for using Amazon DynamoDB:

  • Amazon.DynamoDB.DocumentModel provides helper classes to simplify working with tables and data. The key structures are the Table and Document classes.
  • Amazon.DynamoDB.DataModel provides an object persistence framework for mapping client-side classes to Amazon DynamoDB data. The key structures are the DynamoDBContext class and a number of Attributes that are used to mark up client classes.

Before using any of the Amazon DynamoDB APIs, you need to create a client. The sample below shows multiple options in constructing an instance of AmazonDynamoDBClient.

    AmazonDynamoDBClient client;
    client = new AmazonDynamoDBClient(); // Constructs AmazonDynamoDBClient with the credentials defined in the App.config.
    client = new AmazonDynamoDBClient("accessKey", "secretKey");

The code below shows how a table can be created, populated and scanned, using the base Amazon DynamoDB API.

    // Create table "SampleMovies"
    CreateTableRequest createTableRequest = new CreateTableRequest
        TableName = "SampleMovies",
        ProvisionedThroughput = new ProvisionedThroughput { ReadCapacityUnits = 10, WriteCapacityUnits = 10 },
        KeySchema = new KeySchema { HashKeyElement = new KeySchemaElement { AttributeType = "S", AttributeName = "Name" } }
    Console.WriteLine("Table status: " + client.CreateTable(createTableRequest).CreateTableResult.TableDescription.TableStatus);

    // Wait a few moments for the new table to become active...

    // Put new item
    PutItemRequest putItemRequest = new PutItemRequest
        TableName = "SampleMovies",
        Item = new Dictionary<string, AttributeValue>
            { "Name", new AttributeValue { S = "Bill & Ted's Excellent Adventure" } },
            { "Year", new AttributeValue { N = "1989"} },
            { "Actors", new AttributeValue { SS = new List<string> { "Keanu Reeves", "Alex Winter", "George Carlin" } } }
    Console.WriteLine("Consumed capacity: " + client.PutItem(putItemRequest).PutItemResult.ConsumedCapacityUnits);

    // Scan for movies with a year attribute greater than 1985
    ScanRequest scanRequest = new ScanRequest
        TableName = "SampleMovies",
        ScanFilter = new Dictionary<string, Condition>
            { "Year", new Condition
                    ComparisonOperator = "GT",
                    AttributeValueList = new List<AttributeValue> { new AttributeValue { N = "1985" } }
    Console.WriteLine("Items found: " + client.Scan(scanRequest).ScanResult.Items.Count);

The following code sample shows how the Document and Table helper classes can be used to achieve a similar result.

    // Load table
    Table table = Table.LoadTable(client, "SampleMovies");

    // Create and save document
    Document doc = new Document();
    doc["Name"] = "The Lion King";
    doc["Year"] = 1994;
    doc["Actors"] = new List<string>
        "Jonathan Taylor Thomas", "Matthew Broderick", "James Earl Jones", "Jeremy Irons"

    // Scan table for movies with "Jeremy Irons"
    ScanFilter filter = new ScanFilter();
    filter.AddCondition("Actors", ScanOperator.Contains, "Jeremy Irons");
    Search searchResults = table.Scan(filter);
    List<Document> items = searchResults.GetRemaining();
    Console.WriteLine("Items: " + items.Count);

Alternatively, you can use the Amazon.DynamoDB.DataModel namespace and associate structures to mark up a class and accomplish similar results.

The following code sample shows an annotated class.

    public class SampleMovie
        public string Name { get; set; }

        public int Year { get; set; }
        public List Actors { get; set; }

The following code sample shows how this class can be stored in Amazon DynamoDB.

    // Create DynamoDBContext
    DynamoDBContext context = new DynamoDBContext(client);

    // Create and save movie
    SampleMovie movie = new SampleMovie
        Name = "The English Patient",
        Year = 1996,
        Actors = new List { "Ralph Fiennes", "Juliette Binoche", "Willem Dafoe" }

    // Scan for movies made before 2000 with "English" in the title
    IEnumerable items = context.Scan(
        new ScanCondition("Name", ScanOperator.Contains, "English"),
        new ScanCondition("Year", ScanOperator.LessThan, 2000));
    Console.WriteLine("Items: " + items.Count());
    Console.WriteLine("Items: " + items.Count());
Updated ActionIdentifier Constants

The ActionIdentifier constants found in the Amazon.Auth.AccessControlPolicy.ActionIdentifiers namespace have been updated to contain the latest constants used for creating policies and match the names found in AWS documentation as well as the AWS Policy Generator.

CloudFormationActionIdentifers and CloudFrontActionIdentifers where renamed to CloudFormationActionIdentifiers and CloudFrontActionIdentifiers.

AllSqsActions was renamed to AllSQSActions

The following S3 action constants were renamed to match the S3 documentation.

Original Constant New Constant
SetObjectAcl PutObjectAcl
SetObjectVersionAcl PutObjectAclVersion
ListObjects ListBucket
ListObjectVersions ListBucketVersions
ListBuckets ListAllMyBuckets
SetBucketAcl PutBucketAcl
GetBucketVersioningConfiguration GetBucketVersioning
SetBucketVersioningConfiguration PutBucketVersioning
GetBucketRequesterPays GetBucketRequestPayment
SetBucketRequesterPays PutBucketRequestPayment
GetBucketNotificationConfiguration GetBucketNotification
SetBucketNotificationConfiguration PutBucketNotification

Amazon SNS Delivery Policies

Amazon SNS Delivery Policies give you options to control the delivery rate and error handling for each SNS endpoint. You can, for example, use a Delivery Policy to avoid overwhelming a particular endpoint with a sudden barrage of messages. Delivery Policies can be set for Topics and for the endpoints associated with a particular Topic. Each Delivery Policy contains a Retry Policy and a Throttle Policy. With this release, the policies are effective for the HTTP and HTTPS Subscription types.

The following sample shows how these delivery policies can be set:

    SetSubscriptionAttributesRequest setRequest = new SetSubscriptionAttributesRequest()
Amazon SNS Message Formatting

Amazon SNS Message Formatting gives you the ability to publish a message that contains content that is specific to each type of Subscription. You could, for example, send a short message to an SMS endpoint and a longer message to an email endpoint. To use this feature, you set the new MessageStructure parameter to "json" when you call the SNS publish function. The associated message body must contain a JSON object with a default message body and optional message bodies for other protocols.

The below code sample shows how this feature can be used:

    PublishRequest pubRequest = new PublishRequest()
        .WithMessage("{\"default\" : \"Server busy.\",\"email\":\"Your server is busy\",\"sms\" : \"ALERT! Server Busy!!\", \"https\" : \"ServerBusy\"}");

Known Issues

Issue Description
Installation Requires Administrator Privileges The default install location is %PROGRAMFILES%, which on most computers is "c:\program files". In order to install files to the default location, the MSI must be run by an Administrator. If you don't have Administrator privileges on the machine, please change the install location to something like "c:\Documents and Settings\<you>\AWS SDK for .NET", and the install will complete successfully. If you are running on Vista, your personal folder is similar to "c:\users\<you>\".
Uninstalling the SDK Produces "Unknown Publisher" Message On Windows Vista, uninstalling the MSI results in an "Unknown Publisher" dialog even though the installer is signed by Amazon Web Services. This is a known Windows Installer bug on Windows Vista, and is documented here:

Supported API Versions

This release of the SDK supports the following API versions:

Service API Version
Amazon CloudFront 2010-11-01
Amazon CloudWatch 2010-08-01
Amazon DynamoDB 2011-12-05
Amazon Elastic Compute Cloud 2011-11-01
Amazon Elastic MapReduce 2009-03-31
Amazon ElastiCache 2011-07-15
Amazon Relational Database Service 2011-04-01
Amazon Simple Email Service 2010-12-01
Amazon Simple Notification Service 2010-03-31
Amazon Simple Queue Service 2011-10-01
Amazon Simple Storage Service 2006-03-01
Amazon SimpleDB 2009-04-15
Auto Scaling 2011-01-01
AWS CloudFormation 2010-05-15
AWS Elastic Beanstalk 2010-12-01
AWS Identity and Access Management 2010-05-08
AWS Import/Export 2010-06-01
AWS Security Token Service 2011-06-15
Elastic Load Balancing 2011-11-15
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.