I have running local dynamoDB in Java integration tests
AmazonDynamoDBLocal embeddedDynamo = DynamoDBEmbedded.create()
AmazonDynamoDB client = embeddedDynamo.amazonDynamoDB();
DynamoDB dynamoDB = new DynamoDB(client);
Now I need to create tables based on definition in SAM template.yaml file. I can just copy that file on classpath using Gradle and parse it by some Java/Groovy tools and then just use parsed map to feed the DynamoDB instance API to create those tables.
But I am wondering if there is any library or tool that does it for me?
Thank you, Lukas
You will need to create it yourself. You can do this using a json file and the aws cli's dynamodb
command, for example:
my-table.json
{
"TableName": "MyTable",
"KeySchema": [
{ "AttributeName": "Id", "KeyType": "HASH" }
],
"AttributeDefinitions": [
{ "AttributeName": "Id", "AttributeType": "S" }
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
aws cli's dynamodb create-table command example
aws dynamodb create-table --cli-input-json file://my-table.json --endpoint-url http://localhost:8000
Notes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.