我正在使用Node.js
var AWS = require('aws-sdk');
AWS.config.update({
region: "region",
endpoint: "https://dynamodb.region.amazonaws.com"
});
var dynamodb = new AWS.DynamoDB();
var params = {
TableName: "acc_new"
};
dynamodb.describeTable(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(JSON.stringify(data));
});
Run Code Online (Sandbox Code Playgroud)
输出:
{ AttributeDefinitions: [ { AttributeName: 'Id', AttributeType: 'S' } ],
TableName: 'acc_new',
KeySchema: [ { AttributeName: 'Id', KeyType: 'HASH' } ],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }
Run Code Online (Sandbox Code Playgroud)
输出仅包含与表关联的键架构(仅散列键和范围键),而不是所有属性。我想获取与表中数据关联的所有属性。
喜欢:
{ AttributeName: 'AccountName', AttributeType: 'S' }
{ AttributeName: 'CreatedBy', AttributeType: …Run Code Online (Sandbox Code Playgroud) 实际上,我想对AWS DynamoDB表项目实施验证,如果规则违反项目字段,这将阻止记录插入/更新。
可能吗?
还是我们可以为dynamoDB表创建触发器lambda,该触发器在插入/更新之前触发。这样我们就可以检查验证规则并进行处理。