Skip to content

Instantly share code, notes, and snippets.

@gklopper
Created January 17, 2013 16:31
Show Gist options
  • Save gklopper/4557297 to your computer and use it in GitHub Desktop.
Save gklopper/4557297 to your computer and use it in GitHub Desktop.
Simple working with Amazon DynamoDB
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