How to insert or delete items from a DynamoDB table using Node.js

First, create a DynamoDB table at https://us-west-2.console.aws.amazon.com/dynamodb . Put attention in the region where you create your database, it is in the URL. In this example, the region is us-west-2.

Then, create a IAM user at https://console.aws.amazon.com/iam/home . For simplicity, select AmazonDynamoDBFullAccess, although later you may want to restrict the permissions of the user. Once the user is created, take note of the Access key ID and the Secret access key.

Then, open a terminal/console, and install the AWS Javascript SDK:

npm install aws-sdk --save

Then, copy and paste the following snippet into a Javascript file and execute. Don’t forget to replace the region, the access key ID and the access key ID.

Happy coding!

JavaScript Keyboard Shortcuts

Google Chrome developer tools

Resume script execution Step over next function call Stpe into next function call Step out of current function
F8 F10 F11 SHIFT + F11
Ctrl + \ Ctrl + ' Ctrl + ; Ctrl + Shift + \

Visual Studio Code Typescript editor

Go to symbol in file Shift + Ctrl + O, @
Go to symbol across all files Ctrl + T, #
Jump to matching bracket Ctrl + Shift + \
Rename symbol F2
All current errors Ctrl + Shift + I
Jump next error F8
Toggle side bar visibility Ctrl + B
Navigate between edit locations Alt + Left Arrow or Right Arrow
Open file by name Ctrl + P
Go to definition F12
Go to Implementation Ctrl + F12

Archive