Created
January 17, 2013 16:31
-
-
Save gklopper/4557297 to your computer and use it in GitHub Desktop.
Simple working with Amazon DynamoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.auth.BasicAWSCredentials | |
import com.amazonaws.services.dynamodb.AmazonDynamoDBClient | |
import collection.JavaConversions._ | |
import com.amazonaws.services.dynamodb.model.{AttributeValue, PutItemRequest} | |
object Value { | |
def apply(s: String) = new AttributeValue(s) | |
def apply(l: Long) = new AttributeValue().withN(l.toString) | |
} | |
val credentials = new BasicAWSCredentials("XXXXXX", "XXXXXX") | |
val client = new AmazonDynamoDBClient(credentials) | |
client.setEndpoint("https://dynamodb.eu-west-1.amazonaws.com") | |
client.putItem(new PutItemRequest("test-table", Map( | |
"event_id" -> Value("/new/id"), | |
"random" -> Value(12334555) | |
))) | |
client.shutdown() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment