AWS DynamoDB
With this integration you can query, insert and modify data from your DynamoDB tables.
Official Websitehttps://aws.amazon.com/dynamodb/
TagsNoSQLdatabaseSaas
- JavaScript
- Python
Documentationhttps://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/index.html
NodeJS packagehttps://www.npmjs.com/package/@aws-sdk/client-dynamodb
Version3.316.0
Documentationhttps://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html
Pypi packagehttps://pypi.org/project/boto3/
Version1.34.23
Source Codehttps://github.com/boto/boto3
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.
- JavaScript
- Python
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);
Integration
New integration from credential
aws_dynamodb_client = yepcode.integration.aws_dynamodb("credential-slug")
New integration from plain authentication data
import boto3
session = boto3.Session(
aws_access_key_id="accessKeyId",
aws_secret_access_key="secretAccessKey",
region_name="region"
)
aws_dynamodb_client = session.client("dynamodb")
List Tables
List tables
response = aws_dynamodb_client.list_tables()
for table in response.get("TableNames", []):
print(table)
Get All Table Items
Get all table items
response = aws_dynamodb_client.scan(TableName='table-name')
for item in response.get("Items", []):
print(item)
Put Item
Put item
item = {
"key-property-name": {"S": "key-property-value"},
"other-prop": {"S": "other-value"},
}
aws_dynamodb_client.put_item(
TableName='table-name',
Item=item
)
Get Item
Get item
response = aws_dynamodb_client.get_item(
TableName='table-name',
Key={'key-property-name': {'S': 'key-property-value'}}
)
print(response.get("Item"))