DynamoDB 101 — Connect to DynamoDB with Node.js

Preparation

Create a User and a Group

Install aws-sdk

npm i aws-sdk

Install dotenv

npm i dotenv

Connect to DynamoDB

DYNAMODB_ACCESS_KEY_ID=IAMADUMMYACCESSKEY
DYNAMODB_SECRET_ACCESS_KEY=iamAdummySecretkey
require("dotenv").config(); // read .env
const AWS = require("aws-sdk");
AWS.config.update({
region: "us-west-1",
accessKeyId: process.env.DYNAMODB_ACCESS_KEY_ID,
secretAccessKey: process.env.DYNAMODB_SECRET_ACCESS_KEY,
});
const docClient = new AWS.DynamoDB.DocumentClient();

Read More

A lifelong learner who has enthusiasm for sharing knowledge; a developer who loves bringing ideas to life.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store