Lecture – Getting Started with NoSQL 

Getting Started with NoSQL

Summary of Video

Shows how to get started using DynamoDB on Amazon Web Service

Prerequisites

Visual Studio 2010 (or greater) and Amazon Web Service Account.

Video Link

Support Materials

More information on loading data and other SDK links

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Amazon;
using Amazon.DynamoDB;
using Amazon.DynamoDB.DocumentModel;
using Amazon.DynamoDB.DataModel;
using Amazon.SecurityToken;
using Amazon.Runtime;
// Add using statements to access AWS SDK for .NET services.
// Both the Service and its Model namespace need to be added
// in order to gain access to a service. For example, to access
// the EC2 service, add:
// using Amazon.EC2;
// using Amazon.EC2.Model;
namespace AWS_App1
{
class Program
{
private static AmazonDynamoDBClient client;
public static void Main(string[] args)
{
try
{
AmazonDynamoDBConfig config = new AmazonDynamoDBConfig();
config.ServiceURL = “http://dynamodb.us-west-2.amazonaws.com”;

client = new AmazonDynamoDBClient(config);

UploadData();
// Upload data (using the .NET SDK helper API to upload data)
Console.WriteLine(“Data uploaded… To continue, press Enter”);

}
catch (AmazonDynamoDBException e) { Console.WriteLine(“DynamoDB Message:” + e.Message); }
catch (AmazonServiceException e) { Console.WriteLine(“Service Exception:” + e.Message); }
catch (Exception e) { Console.WriteLine(“General Exception:” + e.Message); }
Console.ReadLine();
}
private static void UploadData()
{
Table sampleTable = Table.LoadTable(client, “SampleData”);
var d1 = new Document();
d1[“id”] = “1”;
d1[“Field1”] = “A field”;
d1[“Field2”] = “Another Field”;
sampleTable.PutItem(d1);
var d2 = new Document();
d2[“id”] = “2”;
d2[“Field1”] = “A field 2”;
d2[“Field2”] = “Another Field 2”;
sampleTable.PutItem(d2);
}
}
}

All Materials Copyright 2012 Dr. Ron Eaglin