7
votes

I was wondering if its possible to create a dynamodb table from the table definition json itself? I've looked into the aws cli tool and I couldnt find any way of doing this. Just wondering if it's possible.

aws dynamodb create-table file://tabledenifision.json

Thanks!

1
What do you mean you "had no luck"? Did you get an error, and what did the error say? What is inside the tabledenifision.json file?kurtzbot
Sorry about that. I meant I couldnt find any way of doing it. There's no command to read in an entire table schema as jsonwebber
The first two searches on Google for "aws create table json" seem really promising, both directly from AWS itself. 1 2. Do neither of these accomplish what you want?kurtzbot
No, neither of the links accomplish it.Amit Naidu
If you don't know what to put inside tabledefinition.json file, you might use dynobase.dev/dynamodb-table-schema-design-tool. It helps me a lot.Rafal Wiliński

1 Answers

31
votes

I found your unanswered question today, and kept looking until I found an answer. Probably too late for you but may help others.

aws dynamodb create-table --cli-input-json file://tabledefinition.json

This command expects a json object in the file in the format outlined by the following command:

aws dynamodb create-table --generate-cli-skeleton

This approach seems to work with many aws commands.