ListTablesCommand

Returns an array of table names associated with the current account and endpoint. The output from ListTables is paginated, with each page returning a maximum of 100 table names.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { DynamoDBClient, ListTablesCommand } from "@aws-sdk/client-dynamodb"; // ES Modules import
// const { DynamoDBClient, ListTablesCommand } = require("@aws-sdk/client-dynamodb"); // CommonJS import
const client = new DynamoDBClient(config);
const input = { // ListTablesInput
  ExclusiveStartTableName: "STRING_VALUE",
  Limit: Number("int"),
};
const command = new ListTablesCommand(input);
const response = await client.send(command);
// { // ListTablesOutput
//   TableNames: [ // TableNameList
//     "STRING_VALUE",
//   ],
//   LastEvaluatedTableName: "STRING_VALUE",
// };

Example Usage

 Loading code editorLoading code editor

ListTablesCommand Input

See ListTablesCommandInput for more details

Parameter
Type
Description
ExclusiveStartTableName
string | undefined

The first table name that this operation will evaluate. Use the value that was returned for LastEvaluatedTableName in a previous operation, so that you can obtain the next page of results.

Limit
number | undefined

A maximum number of table names to return. If this parameter is not specified, the limit is 100.

ListTablesCommand Output

See ListTablesCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
LastEvaluatedTableName
string | undefined

The name of the last table in the current page of results. Use this value as the ExclusiveStartTableName in a new request to obtain the next page of results, until all the table names are returned.

If you do not receive a LastEvaluatedTableName value in the response, this means that there are no more table names to be retrieved.

TableNames
string[] | undefined

The names of the tables associated with the current account at the current endpoint. The maximum size of this array is 100.

If LastEvaluatedTableName also appears in the output, you can use this value as the ExclusiveStartTableName parameter in a subsequent ListTables request and obtain the next page of results.

Throws

Name
Fault
Details
InternalServerError
server

An error occurred on the server side.

InvalidEndpointException
client
DynamoDBServiceException
Base exception class for all service exceptions from DynamoDB service.