Creating service client requests - Amazon SDK for JavaScript
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

The Amazon SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the Amazon SDK for JavaScript version 3 (V3).

Starting October 1, 2022, Amazon SDK for JavaScript (v3) will end support for Internet Explorer 11 (IE 11). For details, see Announcing the end of support for Internet Explorer 11 in the Amazon SDK for JavaScript (v3).

Creating service client requests

Making requests to Amazon service clients is straightforward. Version 3 (V3) of the SDK for JavaScript enables you to send requests.

Note

You can also perform operations using version 2 (V2) commands when using the V3 of the SDK for JavaScript. For more information, see Using V2 commands.

To send a request:

  1. Initialize a client object with the desired configuration, such as a specific Amazon Region.

  2. (Optional) Create a request JSON object with the values for the request, such as the name of a specific Amazon S3 bucket. You can examine the parameters for the request by looking at the API Reference topic for the interface with the name associated with the client method. For example, if you use the AbcCommand client method, the request interface is AbcInput.

  3. Initialize a service command, optionally, with the request object as input.

  4. Call send on the client with the command object as input.

For example, to list your Amazon DynamoDB tables in us-west-2, you can do it with async/await.

import { DynamoDBClient, ListTablesCommand } from "@aws-sdk/client-dynamodb"; (async function() { const dbClient = new DynamoDBClient({ region: 'us-west-2' }); const command = new ListTablesCommand({}); try { const results = await dbClient.send(command); console.log(results.TableNames.join('\n')); } catch (err) { console.error(err); } })();