Created
November 3, 2017 04:03
-
-
Save nbenns/1b20b39a51b8d7f614913a38273f0d3c to your computer and use it in GitHub Desktop.
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.{AWSStaticCredentialsProvider, BasicAWSCredentials} | |
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder | |
import com.amazonaws.services.dynamodbv2.model._ | |
import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._ | |
import scala.collection.convert.decorateAsJava._ | |
val credentials = new BasicAWSCredentials("dev", "dev") | |
val credProvider = new AWSStaticCredentialsProvider(credentials) | |
val endpointConfiguration = new EndpointConfiguration("http://localhost:8000", "local") | |
val tableName = "profile-table" | |
val client = | |
AmazonDynamoDBClientBuilder.standard() | |
.withCredentials(credProvider) | |
.withEndpointConfiguration(endpointConfiguration) | |
.build() | |
val keySchemas = List( | |
new KeySchemaElement("id", KeyType.HASH) | |
).asJava | |
val attibutedefs = List( | |
new AttributeDefinition("id", S) | |
).asJava | |
client.createTable(attibutedefs, tableName, keySchemas, new ProvisionedThroughput(1L, 1L)) | |
//client.deleteTable(tableName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment