Skip to main content

AWS DynamoDB

Credential configuration

To configure this credential, you need the Access Key ID and the Secret Access Key of the Programatic access user you want to use. Ensure that this user has the necessary permissions to access DynamoDB for proper functionality. If you need to create the user, follow the instructions provided here.

In the extra options field, you can include any additional params found here.

Here is an example of a filled credential configuration form in YepCode:

AWS DynamoDB Snippets available in YepCode editor

note

The title is the triggering text for YepCode to autocomplete the script.

Integration

New integration from credential
const awsDynamodbClient = yepcode.integration.awsDynamodb("credential-slug");
New integration from plain authentication data
const { DynamoDBClient } = require("@aws-sdk/client-dynamodb");

const awsDynamodbClient = new DynamoDBClient({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",
},
});

List Tables

List tables
const { ListTablesCommand } = require("@aws-sdk/client-dynamodb");
const listTablesCommand = new ListTablesCommand({});

const listTablesResponse = await awsDynamodbClient.send(listTablesCommand);

console.log(listTablesResponse);

Get all Table Items

Get all table items
const { ScanCommand } = require("@aws-sdk/client-dynamodb");
const scanCommand = new ScanCommand({ TableName: "table-name" });

const scanResponse = await awsDynamodbClient.send(scanCommand);

console.log(scanResponse.Items);

Put Item

Put item
const { PutItemCommand } = require("@aws-sdk/client-dynamodb");
const putItemCommand = new PutItemCommand({
TableName: "table-name",
Item: {
"table-primary-key-name": { S: "table-primary-key-value" },
someOther: { S: "other-value" },
},
});

const putItemResponse = await awsDynamodbClient.send(putItemCommand);

console.log(putItemResponse);

Get Item

Get item
const { GetItemCommand } = require("@aws-sdk/client-dynamodb");
const getItemCommand = new GetItemCommand({
TableName: "table-name",
Key: {
"table-primary-key-name": { S: "table-primary-key-value" },
},
});

const getItemResponse = await awsDynamodbClient.send(getItemCommand);

console.log(getItemResponse);