|
1 |
| -# Export Amazon DynamoDB Tables to NoSQL Workbench |
| 1 | +# 🚀 Export Amazon DynamoDB Tables to NoSQL Workbench |
2 | 2 |
|
3 |
| -This directory contains a node.js script that when run, will export a table's meta data and the first 1MB worth of data into a format that can be imported into [NoSQL Workbench for Amazon DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.html). |
| 3 | +This guide will help you export the schema and first 1MB of data from an existing DynamoDB table using the script **create-workbench-import.js**. The script's JSON output can be imported into [NoSQL Workbench for Amazon DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.html) to create the table and populate the data within NoSQL Workbench. |
4 | 4 |
|
5 |
| -You will need to modify the script to add the Amazon Web Services Region you want to export. This script relies on the credentials in ~/.aws to authenticate. The command directs the json output to stdout. You should attempt to run it with a credential that has read only access to the table. |
| 5 | +## 🏃 How to Get Started |
6 | 6 |
|
7 |
| -`node create-workbench-import.js YourTableNameHere > YourTableNameHere.json` |
| 7 | +1. **Download Script** |
| 8 | + |
| 9 | + Copy the `create-workbench-import.js` file to the folder you wish to run it from. |
8 | 10 |
|
9 |
| -Once you have the JSON file from your table, you can perform a "import data model" in NoSQL Workbench to bring it into the tool. |
| 11 | +2. **Install Node.js** |
10 | 12 |
|
11 |
| -Initial script by [Rob McCauley](https://github.com/robm26). |
| 13 | + Make sure you’ve got Node.js installed on your machine. |
| 14 | + 👉 [Get Node.js here](https://nodejs.org/en) |
12 | 15 |
|
13 |
| -This script is provided as is and at your own risk. There are no guarantees expressly written or implied. |
| 16 | +3. **Install AWS SDK for JavaScript** |
| 17 | + |
| 18 | + Make sure you’ve got AWS SDK for JavaScript installed on your machine. |
| 19 | + 👉 [Get AWS SDK for JavaScript here](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/installing-jssdk.html) |
| 20 | + |
| 21 | +4. **Modify the Region in the Script** |
| 22 | + |
| 23 | + You may need to modify line 13 in the script and update the region name to the appropriate AWS Region for your existing DynamoDB table. |
| 24 | + ``` |
| 25 | + AWS.config.region = process.env.AWS_REGION || 'us-east-1'; |
| 26 | + ``` |
| 27 | +6. **Credentials** |
| 28 | + |
| 29 | + This script relies on the credentials in `~/.aws` to authenticate. You should run it with a credential that has read only access to the table. |
| 30 | + |
| 31 | +8. **Run the Script** |
| 32 | + |
| 33 | + Open a terminal, navigate to the script folder, and run the below command, replacing "YourTableNameHere" with your existing DynamoDB table name. |
| 34 | + ``` |
| 35 | + node create-workbench-import.js YourTableNameHere > YourTableNameHere.json |
| 36 | + ``` |
| 37 | + The command directs the JSON output to `YourTableNameHere.json` |
| 38 | + |
| 39 | + If you wish to direct the output to stdout instead of a file, leave off the `> YourTableNameHere.json` in the command. |
| 40 | + |
| 41 | + ``` |
| 42 | + node create-workbench-import.js YourTableNameHere |
| 43 | + ``` |
| 44 | + |
| 45 | +10. **Use the JSON File to Import into NoSQL Workbench** |
| 46 | + |
| 47 | + Once you have the JSON file from your table, you can perform a "import data model" in NoSQL Workbench to bring it into the tool. |
| 48 | + \ |
| 49 | + \ |
| 50 | + \ |
| 51 | + Initial script by [Rob McCauley](https://github.com/robm26). |
| 52 | + |
| 53 | + This script is provided as is and at your own risk. There are no guarantees expressly written or implied. |
0 commit comments