DynamoDB Connector
Provides a standardized way to connect to an AWS DynamoDB database using the v3 AWS javascript SDK.
Install
npm install @brightcove/dynamodb-connector --save
Usage
Version 2.x
const { DynamoDBConnector } = require('@brightcove/dynamodb-connector');
// Localstack configuration example
const db = new DynamoDBConnector({
clientConfig: {
endpoint: 'http://localhost:4566,
region: 'us-east-1'
}
});
...
const result = await db.query({
TableName: 'my-table',
...
});
Options
Version 3.x
This version includes breaking changes by requiring the DynamoDBClientConfig
to be passed in as an option. This drasticaly reduces the size of this package.
import { DynamoDBConnector } from '@brightcove/dynamodb-connector';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
// Localstack configuration example
const client = new DynamoDBClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1'
});
const db = new DynamoDBConnector({ client });
...
const result = await db.query({
TableName: 'my-table',
...
});
Options