I just managed to do a complete dump and "restore" using bchew/dynamodump:

git clone [email protected]:bchew/dynamodump.git

Notice the --schemaOnly option in the documentation https://github.com/bchew/dynamodump. Command was:

./dynamodump.py -m backup --schemaOnly --region foo-region --host localhost --srcTable '*' --port 8000 --accessKey fooKey --secretKey barKey

Then you can use the -m restore mode to put the data or schema back into a local dynamodb or wherever desired :)

With that said, I still find it unbelievable how bad is the amazon dynamodb tool-chain. Come on guys.

Answer from marcio on Stack Overflow
🌐
AWS
aws.amazon.com › blogs › database › working-with-json-data-in-amazon-dynamodb
Working with JSON data in Amazon DynamoDB | Amazon Web Services
May 1, 2023 - Amazon DynamoDB allows you to store JSON objects into attributes and perform many operations on these objects, including filtering, updating, and deleting. This is a very powerful capability because it allows applications to store objects (JSON data, arrays) directly into DynamoDB tables, and ...
🌐
DynamoDB
dynobase.dev › dynamodb-table-schema-design-tool
DynamoDB Table Schema Design Tool [Free to Use]
Use this free tool to help you design your DynamoDB table schema visually and generate JSON that can then be used to create the DynamoDB table.
Discussions

amazon web services - How to export an existing dynamo table schema to json? - Stack Overflow
I'd like to replicate some dynamodb tables, schema only, into my local environment for testing purposes. First I've tried: aws dynamodb describe-table --table-name Foo > FooTable.json But it's More on stackoverflow.com
🌐 stackoverflow.com
[Source DynamoDB] Defining JSON Schema for NoSQL databases
I started working on a new connector source-dynamodb. (see the PR #14555) The way I’m thinking of developing the new connector is to add each listed table as a stream (detailed tables could be narrowed with a prefix query or directly with the IAM permissions provided). More on discuss.airbyte.io
🌐 discuss.airbyte.io
0
0
July 9, 2022
Using DynamoDB as a JSON dump store?
Yes. Just create a table where your ID is the hash key and dump it all as a record. However, if you're just storing data using an ID, it might be cheaper to save the json as a file in an S3 bucket. More on reddit.com
🌐 r/aws
13
1
April 28, 2021
python - How can I structure my JSON schema to validate for DynamoDB and RESTAPI? - Stack Overflow
I am writing a REST API that will store several complex objects to an AWS DynamoDB and then when requested, retrieve them, perform computations on them, and return a result. Here is a big of extrac... More on stackoverflow.com
🌐 stackoverflow.com
December 12, 2018
People also ask

What should I do with this DynamoDB JSON?
When using SDK or CLI, you need to use it as the table definition parameter when calling CreateTable operation. When using CloudFormation, SAM or Serverless Framework, paste this into your 'infrastructure-as-code' DynamoDB::Table.Properties value
🌐
dynobase.dev
dynobase.dev › dynamodb-table-schema-design-tool
DynamoDB Table Schema Design Tool [Free to Use]
How do I see DynamoDB table data?
After you've entered some data to the table, it is likely that you'll need to debug it. You can inspect table contents using AWS Console or Dynobase.
🌐
dynobase.dev
dynobase.dev › dynamodb-table-schema-design-tool
DynamoDB Table Schema Design Tool [Free to Use]
Are DynamoDB tables schemaless?
Yes. When creating a table in DynamoDB, you don't have to define any other attributes besides ones that are used by primary key and global secondary keys.
🌐
dynobase.dev
dynobase.dev › dynamodb-table-schema-design-tool
DynamoDB Table Schema Design Tool [Free to Use]
🌐
GitHub
github.com › Charliekenney23 › dynamodb-json-schema
GitHub - 0xch4z/dynamodb-json-schema: Generate dynamodb table schema from json schema · GitHub
import * as fs from "fs"; import { getTableSchema } from "dynamodb-json-schema"; const USER_SCHEMA = JSON.parse(fs.readFileSync("User.json", "utf8")); const tableSchema = getTableSchema({ tableName: "users-table", hashKey: "id", itemSchema: USER_SCHEMA }); /* => { "TableName": "users-table", "KeySchema": [{ "AttributeName": "id", "AttributeType": "HASH" }], "AttributeDefinitions": [{ "AttributeName": "id", "AttributeType": "S" }] } */
Author   0xch4z
Top answer
1 of 3
19

I just managed to do a complete dump and "restore" using bchew/dynamodump:

git clone [email protected]:bchew/dynamodump.git

Notice the --schemaOnly option in the documentation https://github.com/bchew/dynamodump. Command was:

./dynamodump.py -m backup --schemaOnly --region foo-region --host localhost --srcTable '*' --port 8000 --accessKey fooKey --secretKey barKey

Then you can use the -m restore mode to put the data or schema back into a local dynamodb or wherever desired :)

With that said, I still find it unbelievable how bad is the amazon dynamodb tool-chain. Come on guys.

2 of 3
6

This takes aws dynamodb describe-table output, and transforms it into the input-format of aws dynamodb create-table --cli-input-json:

AWS_PROFILE=xyz aws dynamodb describe-table --table-name MyTable > mytable_full.json

# Pull out just what is minimally needed for table-creation:
#
#  TableName
#  KeySchema
#  AttributeDefinitions (must only contain attributes used in keys)
#  Global/Local Secondary Indexes
#  Defaults BillingMode to PAY_PER_REQUEST
#   (any provisioning can be set up manually based on load)

jq <mytable_full.json '.Table | {TableName, KeySchema, AttributeDefinitions} + (try {LocalSecondaryIndexes: [ .LocalSecondaryIndexes[] | {IndexName, KeySchema, Projection} ]} // {}) + (try {GlobalSecondaryIndexes: [ .GlobalSecondaryIndexes[] | {IndexName, KeySchema, Projection} ]} // {}) + {BillingMode: "PAY_PER_REQUEST"}' ​>mytable.json

AWS_PROFILE=xyz aws dynamodb create-table --cli-input-json file://mytable.json

You can also paste the json into python (the python dict syntax closely matches json) eg

import boto3

dynamodb = boto3.resource("dynamodb")

tabledef = {
    "TableName": "MyTable",
    "KeySchema": [
...
}

table = dynamodb.create_table(**tabledef)
print("Table status: ", table.table_status)

References:

https://docs.aws.amazon.com/cli/latest/reference/dynamodb/describe-table.html https://docs.aws.amazon.com/cli/latest/reference/dynamodb/create-table.html https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html https://boto3.amazonaws.com/v1/documentation/api/latest/guide/dynamodb.html#creating-a-new-table

🌐
AWS re:Post
repost.aws › knowledge-center › appsync-nested-json-data-in-dynamodb
Configure AWS AppSync to handle JSON data in DynamoDB | AWS re:Post
October 7, 2022 - Add a nested JSON data item to the DynamoDB table. Create an AWS AppSync API and attach the data source. Configure the nested JSON schema in the AWS AppSync API.
Find elsewhere
🌐
GitHub
github.com › shichongrui › json-schema-dynamo
GitHub - shichongrui/json-schema-dynamo
An easier way to transform objects into DynamoDB items · var transformers = require('json-schema-dynamo') var schema = { type: 'object', properties: { id: { type: 'string' }, createDate: { type: 'date' }, name: { type: 'string' }, active: { type: 'boolean' }, likes: { type: 'number' }, types: { type: 'array', items: { type: 'string' } }, userIds: { type: 'array', items: { type: 'number' } } } } var model = { id: 'asdf', createDate: new Date(), name: 'asdffdas', likes: 1, active: true, types: ['qwerty', 'ytrewq'], userIds: [1, 2, 3, 4, 5, 6, 7] } var item = transformers.fromModelToDynamoItem(s
Starred by 9 users
Forked by 3 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
npm
npmjs.com › package › json-schema-dynamo
json-schema-dynamo - npm
An easier way to transform objects into DynamoDB items · var transformers = require('json-schema-dynamo') var schema = { type: 'object', properties: { id: { type: 'string' }, createDate: { type: 'date' }, name: { type: 'string' }, active: { type: 'boolean' }, likes: { type: 'number' }, types: { type: 'array', items: { type: 'string' } }, userIds: { type: 'array', items: { type: 'number' } } } } var model = { id: 'asdf', createDate: new Date(), name: 'asdffdas', likes: 1, active: true, types: ['qwerty', 'ytrewq'], userIds: [1, 2, 3, 4, 5, 6, 7] } var item = transformers.fromModelToDynamoItem(s
      » npm install json-schema-dynamo
    
Published   Dec 17, 2020
Version   0.6.0
Author   Matthew Sessions
🌐
Airbyte
discuss.airbyte.io › connector development
[Source DynamoDB] Defining JSON Schema for NoSQL databases - Connector Development - Airbyte
July 9, 2022 - I started working on a new connector source-dynamodb. (see the PR #14555) The way I’m thinking of developing the new connector is to add each listed table as a stream (detailed tables could be narrowed with a prefix que…
🌐
Codemia
codemia.io › home › knowledge hub › create a dynamodb table from json
Create a DynamoDB table from json | Codemia
July 30, 2025 - JSON File: The source file containing the data to be imported into DynamoDB. First, you need to define the table schema, which includes specifying the primary key attributes:
🌐
Reddit
reddit.com › r/aws › using dynamodb as a json dump store?
r/aws on Reddit: Using DynamoDB as a JSON dump store?
April 28, 2021 -

I have some JSON which has a variable number of fields. It will always have an "ID" field however.

What I want to know is: Does DynamoDB support just dumping this JSON in a table regardless of what fields it has? What I would like there to be would be an "ID" field and a "data" field in the table, where the "data" is simply all the JSON except the ID.

Without using Dynamo's specific structure I can't see how this is possible, but I wanted to get another opinion. Can Dynamo support JSON which has no set structure or schema whatsoever?

Top answer
1 of 1
2

I ended up finding a solution to this. Effectively, what I've done is to generate the Marshmallow schema exclusively for translation from the DynamoDB into the Python objects. All Schema classes have @post_load methods that translate into the Python objects and all fields are labeled with the type they need to be in the Python world, not the database world.

When validating the input from the REST API and ensuring that no bad data is allowed to get into the database, I call MySchema().validate(input_json), check to see that there are no errors, and if not, dump the input_json into the database.

This leaves only one extra problem which is that the input_json needs to be cleaned up for entry into the Database, which I was previously doing with Marshmallow. However, this can also easily be done by adjusting my JSON decoder to read Decimals from floats.

So in summary, my JSON decoder is doing the work of recursively walking the data structure and converting Float to Decimal separately from Marshmallow. Marshmallow is running a validate on the fields of every object, but the results are only checked for errors. The original input is then dumped into the database.

I needed to add this line to do the conversion to Decimal.

app.json_decoder = partial(flask.json.JSONDecoder, parse_float=decimal.Decimal)

My create function now looks like this. Notice how the original input_json, parsed by my updated JSON decoder, is inserted directly into the database, rather than any data mundged output from Marshmallow.

@app.route("/machine/<uuid:machine_id>", methods=['POST'])
def create_machine(machine_id):
    input_json = request.get_json() # Already ready to be DB input as is.
    errors = MachineSchema().validate(input_json)
    if errors:
      return jsonify({"status": "failure",message = dumps(errors)})
    else:
      input_json['id'] = machine_id
      dynamodb.Table('machine').put_item(Item=input_json)
      return jsonify({"status", "success", error_message = ""})
🌐
npm
npmjs.com › package › dynamodb-json-schema
dynamodb-json-schema - npm
July 11, 2019 - > Generate dynamodb table schema from json schema. Latest version: 0.1.2, last published: 7 years ago. Start using dynamodb-json-schema in your project by running `npm i dynamodb-json-schema`. There are no other projects in the npm registry using dynamodb-json-schema.
      » npm install dynamodb-json-schema
    
Published   Jul 11, 2019
Version   0.1.2
🌐
DEV Community
dev.to › danielbayerlein › how-to-store-json-in-amazon-dynamodb-using-aws-appsync-3956
How to store JSON in Amazon DynamoDB using AWS AppSync - DEV Community
August 5, 2020 - Instead, map the JSON within the schema. For reasons of clarity, I describe only the mutation. input MultilingualDescriptionInput { en: String! de: String! } input PutAppInput { name: String! description: MultilingualDescriptionInput! } type Mutation { createApp(input: PutAppInput!): App } In the request mapping template I use the utility helpers of AWS AppSync. ... { "version" : "2018-05-29", "operation" : "PutItem", "key" : { "id" : $util.dynamodb.toDynamoDBJson($ctx.args.input.name.replace(" ", "-").toLowerCase())) }, "attributeValues" : $util.dynamodb.toMapValuesJson($ctx.args.input) }
🌐
Codemia
codemia.io › knowledge-hub › path › how_to_export_an_existing_dynamo_table_schema_to_json
How to export an existing dynamo table schema to json?
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises
🌐
GitHub
github.com › aws-samples › amazon-dynamodb-design-patterns › blob › master › examples › an-online-shop › json › AnOnlineShop_8.json
amazon-dynamodb-design-patterns/examples/an-online-shop/json/AnOnlineShop_8.json at master · aws-samples/amazon-dynamodb-design-patterns
"Description": "This data model represents an Amazon DynamoDB schema for an online shop.", "Version": "1.0" }, "DataModel": [ { "TableName": "OnlineShop", "KeyAttributes": { "PartitionKey": { "AttributeName": "PK", "AttributeType": "S" }, "SortKey": { "AttributeName": "SK", "AttributeType": "S" } }, "NonKeyAttributes": [ { "AttributeName": "EntityType", "AttributeType": "S" }, { "AttributeName": "Email", "AttributeType": "S"
Author   aws-samples
🌐
Insightsoftware
documentation.insightsoftware.com › simba-dynamodb-jdbc-driver › content › jdbc › dy › features › schemadefn.htm
Schema Definition
To ensure consistent support for your DynamoDB data, you must configure the connector to use a schema definition from a JSON file or the database.
🌐
Formkiq
docs.formkiq.com › platform architecture › dynamodb schema
DynamoDB Schema | FormKiQ
The Site Entity Schema stores the JSON schema configuration for a site-level entity.
🌐
AWS Fundamentals
awsfundamentals.com › blog › aws-dynamodb-data-types
AWS DynamoDB Data Types
September 12, 2022 - The DynamoDB JSON representation shows you how the datatypes are represented internally in DynamoDB.
🌐
Tibco
integration.cloud.tibco.com › docs › Subsystems › flogo-amazondynamodb › users-guide › amazon-dynamodb-query.html
Amazon DynamoDB Query
You can enable the Use app level schema toggle switch to configure the DynamoDB JSON response from app level schema.