Skip to main content
This guide walks you through installing the DynamoDB client, creating a client, and listing your DynamoDB tables. The same pattern applies to every other AWS service.
You need valid AWS credentials before making API calls. The SDK reads credentials from environment variables, ~/.aws/credentials, IAM roles, and other sources automatically. See Authentication for the full list of credential providers.
1

Create a Node.js project

If you don’t already have a project, create one:
mkdir my-aws-app && cd my-aws-app
npm init -y
2

Install the DynamoDB client

Each AWS service has its own package. Install only the one you need.
npm install @aws-sdk/client-dynamodb
Commit your lock file (package-lock.json or yarn.lock) alongside your code. This prevents unexpected version changes from breaking your application.
3

Send your first command

Create a file called index.js and add the following code. It creates a DynamoDB client for us-west-2, sends a ListTablesCommand, and prints your table names.
index.js
const { DynamoDBClient, ListTablesCommand } = require("@aws-sdk/client-dynamodb");

(async () => {
  const client = new DynamoDBClient({ region: "us-west-2" });
  const command = new ListTablesCommand({});
  try {
    const results = await client.send(command);
    console.log(results.TableNames.join("\n"));
  } catch (err) {
    console.error(err);
  }
})();
Run the file:
node index.js
If your credentials are configured and you have DynamoDB tables in us-west-2, their names print to the console.
4

Try the aggregated style (optional)

V3 also supports a v2-compatible aggregated style where all commands are available as methods directly on the client. This is convenient for quick scripts but imports all commands, which increases bundle size.
index.js
const { DynamoDB } = require("@aws-sdk/client-dynamodb");

(async () => {
  const client = new DynamoDB({ region: "us-west-2" });
  try {
    const results = await client.listTables({});
    console.log(results.TableNames.join("\n"));
  } catch (err) {
    console.error(err);
  }
})();
Both styles call the same underlying API. The difference is only in what gets imported. For production applications and anything built with a bundler, prefer the bare-bones style (DynamoDBClient + ListTablesCommand) so tree shaking can remove unused commands.

How it works

Every SDK operation follows the same three-step pattern regardless of the service:
  1. Create a client — instantiate a service-specific client with at minimum a region.
  2. Create a command — instantiate a command with the input parameters for the operation.
  3. Send the command — call client.send(command) and await the response.
import { S3Client, ListBucketsCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });           // 1. Client
const command = new ListBucketsCommand({});                      // 2. Command
const response = await client.send(command);                     // 3. Send
console.log(response.Buckets);

Next steps

Installation

Install clients for other services, credential providers, and higher-level libraries.

Authentication

Configure credentials with environment variables, IAM roles, SSO, and more.

Core concepts

Learn about clients, commands, the middleware stack, and paginators.

Migrating from v2

Upgrade an existing v2 application to v3.

Build docs developers (and LLMs) love