Last active
June 8, 2016 18:38
-
-
Save yusefnapora/842312bc3e1be6c1e35c551c8864f6dc to your computer and use it in GitHub Desktop.
setup local dynamo for mediachain
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 | |
val awscreds = new BasicAWSCredentials("", "") | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient | |
val dynamo = new AmazonDynamoDBClient(awscreds).withEndpoint("http://localhost:8000").asInstanceOf[AmazonDynamoDBClient] | |
import scala.collection.JavaConversions._ | |
import com.amazonaws.services.dynamodbv2.model._ | |
val baseTable = "Mediachain" | |
val chunkTable = baseTable + "Chunks" | |
val mainTableAttrs = List(new AttributeDefinition("multihash", "S")) | |
val mainTableSchema = List(new KeySchemaElement("multihash", KeyType.HASH)) | |
val pth = new ProvisionedThroughput(10, 10) | |
dynamo.createTable(mainTableAttrs, baseTable, mainTableSchema, pth) | |
val chunkTableAttrs = List(new AttributeDefinition("chunkId", "S")) | |
val chunkTableSchema = List(new KeySchemaElement("chunkId", KeyType.HASH)) | |
dynamo.createTable(chunkTableAttrs, chunkTable, chunkTableSchema, pth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment