Serverless DynamoDB Client Plugin

0.0.2 · abandoned · verified Tue Apr 21

serverless-dynamodb-client is an abandoned Serverless Framework plugin designed to simplify interaction with AWS DynamoDB, providing a consistent API for both local DynamoDB instances and the AWS cloud service. Released as version `0.0.2` and last updated over 7 years ago, it was built specifically for Serverless Framework `0.5.x`. This package provides convenience wrappers for the AWS SDK's `DynamoDB` and `DynamoDB.DocumentClient` classes, automatically configuring them to point to a local DynamoDB instance (specifically on port 8000) when `serverless-dynamodb-local` is active, or to AWS otherwise. Due to its age and reliance on an extremely old version of the Serverless Framework, it is not compatible with modern Serverless setups (v1.x and above) and should not be used in new projects.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `serverless-dynamodb-client` to obtain the `raw` DynamoDB client and then list existing tables. It highlights the basic CommonJS `require` pattern for this legacy plugin.

const dynamodb = require('serverless-dynamodb-client');
const rawClient = dynamodb.raw;

module.exports.listTables = async (event) => {
  try {
    // Ensure that serverless-dynamodb-local is running on port 8000 for local testing
    const data = await rawClient.listTables().promise();
    console.log("DynamoDB Tables:", data.TableNames);

    return {
      statusCode: 200,
      body: JSON.stringify({
        message: 'Successfully listed DynamoDB tables (see console)',
        tables: data.TableNames,
      }),
    };
  } catch (error) {
    console.error("Error listing tables:", error);
    return {
      statusCode: 500,
      body: JSON.stringify({
        message: 'Failed to list DynamoDB tables',
        error: error.message,
      }),
    };
  }
};

view raw JSON →