All Articles

Announcing dynamodb-csv-export-import

I put together a small utility for working with the CSV files exported by the DynamoDB AWS Console. It allows you to import them again into a DynamoDB table.

This can be handy for when you want to take some test data from the AWS Console and work with it in another DynamoDB table or locally. (NOTE: it isn’t a generic CSV export/import for DynamoDB).

Exporting CSVs from the AWS DynamoDB Console

In the Items tab of a DynamoDB table view, you can run scans and queries against a table or its secondary indexes. After you execute an operation, you can checkbox items from the result set and select Export to csv from the Actions menu.

Export to csv

The CSV format it uses is a bit unusual (a combination of text fields and DynamoDB JSON structures), but it contains all the required type information, so there was the ability to create this tool.

Using the utility

You can install it as a CLI by running:

npm i -g @chris-armstrong/dynamodb-csv-export-import

It’s written in JavaScript, so you’ll need Node.js installed.

Next, you will need to set the import region

export AWS_DEFAULT_REGION=us-west-2

and then you can run the import function

dynamodb-csv-export-import <csv_filename> <table_name>