The Delete Item In Dynamo DB extension deletes an item from an Amazon DynamoDB table from inside a Virtuoso journey.
This is useful when your test needs to clean up test records, remove temporary database data, or reset DynamoDB-backed test state by using a known primary key.
Parameters:
-
regionrequired, string, the AWS region where the DynamoDB table is located, for exampleus-west-2; -
accessKeyrequired, string, the AWS access key ID used to connect to DynamoDB. Store this as an environment variable where possible; -
secreteKeyrequired, string, the AWS secret access key used to connect to DynamoDB. This input name follows the source code spelling. Store this as an environment variable where possible; -
tablename1required, string, the name of the DynamoDB table where the item should be deleted; -
primaryKey1required, JSON string, the DynamoDB primary key to delete. This should include the partition key and, where required by the table, the sort key.
Note: The primaryKey1 value must be valid JSON because the extension parses it using JSON.parse(primaryKey1). The JSON key names and value types must match the DynamoDB table key schema exactly.
How to apply this to your journey
Use the extension in a journey by calling Delete Item In Dynamo DB with the execute command. Pass each value to the matching extension input using as inputName.
Note: Script inputs are passed as text in Virtuoso. Because of this, pass the primaryKey1 value as a JSON string, for example {"partitionKey":"PrimaryKeyValue","sortKey":"SortKeyValue"}. Use the exact source input name secreteKey when mapping the secret key value.
To delete an item from a DynamoDB table:
execute "Delete Item In Dynamo DB" using "us-west-2" as region, "$awsAccessKey" as accessKey, "$awsSecretKey" as secreteKey, "TableName" as tablename1, '{"partitionKey":"PrimaryKeyValue","sortKey":"SortKeyValue"}' as primaryKey1 returning $responseTo delete an item using only a partition key:
execute "Delete Item In Dynamo DB" using "us-west-2" as region, "$awsAccessKey" as accessKey, "$awsSecretKey" as secreteKey, "TableName" as tablename1, '{"id":"PrimaryKeyValue"}' as primaryKey1 returning $responseYou can also use Virtuoso variables to make the same step reusable across different AWS regions, tables, credentials, or primary keys:
execute "Delete Item In Dynamo DB" using "$region" as region, "$accessKey" as accessKey, "$secretKey" as secreteKey, "$tableName" as tablename1, "$primaryKey" as primaryKey1 returning $responseExample setup using variables before calling the extension:
store value "us-west-2" in $region
store value "TableName" in $tableName
store value '{"partitionKey":"PrimaryKeyValue","sortKey":"SortKeyValue"}' in $primaryKey
execute "Delete Item In Dynamo DB" using "$region" as region, "$accessKey" as accessKey, "$secretKey" as secreteKey, "$tableName" as tablename1, "$primaryKey" as primaryKey1 returning $responseWhen the delete request is successful, the extension returns the HTTP status code from the DynamoDB response. For example:
200This extension requires the following resource:
The extension should be configured as:
- Run asynchronously: No
- Scope: Global
Limitation: This extension performs a live DynamoDB delete operation through the browser-loaded AWS SDK for JavaScript v2 resource. Make sure the credentials are scoped carefully, can delete only the intended table items, and are stored as Virtuoso variables rather than hardcoded values. The table must exist in the selected AWS region, and the primaryKey1 JSON must match the table key schema exactly; otherwise the step can fail or delete the wrong item if the supplied key points to the wrong record. The source uses async, await, and a DynamoDB promise, but the extension is configured as Run asynchronously: No to match the provided setup, so validate execution in your Virtuoso instance before relying on the returned status code in later steps. Network restrictions, blocked CDN access, AWS permission errors, throttling, token rotation, or browser/client differences can also prevent the delete request from completing. AWS SDK for JavaScript v2 has reached end-of-support, so plan future maintenance carefully if AWS service behavior, browser support, or security requirements change.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 22/05/2026
Resources:
async function deleteDynamoDBItem(region, accessKey, secretKey, tableName, primaryKey) {
// Configure the AWS SDK with your credentials and region
AWS.config.update({
region: region,
credentials: new AWS.Credentials({
accessKeyId: accessKey,
secretAccessKey: secretKey
})
});
// Create a DynamoDB document client
const dynamoDB = new AWS.DynamoDB.DocumentClient();
try {
// Construct the DeleteItem request parameters
const params = {
TableName: tableName,
Key: primaryKey
};
// Delete the item from DynamoDB
const response = await dynamoDB.delete(params).promise();
const statusCode = response.$response.httpResponse.statusCode;
console.log("Item deleted successfully");
return statusCode;
} catch (error) {
throw error;
}
}
// Example usage:
const awsRegion = region;
const awsAccessKey = accessKey;
const awsSecretKey = secreteKey;
const tableName = tablename1;
const primaryKey = JSON.parse(primaryKey1);
// update this to the primary key value for which you wish to delete the item in DynamoDB
return deleteDynamoDBItem(awsRegion, awsAccessKey, awsSecretKey, tableName, primaryKey);
Comments
0 comments
Please sign in to leave a comment.