Dokumentationen sind schwer zu verstehen. Da Sie die dynamodb-Shell verwenden, nehme ich an, dass Sie nach einer js-Abfrage fragen, um die Tabelle zu erstellen.
var params = {
TableName: 'student',
KeySchema: [
{
AttributeName: 'sid',
KeyType: 'HASH',
},
],
AttributeDefinitions: [
{
AttributeName: 'sid',
AttributeType: 'N',
},
],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10,
},
};
dynamodb.createTable(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
Führen Sie das obige Snippet im Browser (localhost: 8000/shell /). Es erstellt eine Tabelle mit 'sid' als Hash-Schlüssel. Einfügen:
var params = {
TableName: 'student',
Item: { // a map of attribute name to AttributeValue
sid: 123,
firstname : { 'S': 'abc' },
lastname : { 'S': 'xyz' },
address : {'S': 'pqr' },
ReturnValues: 'NONE', // optional (NONE | ALL_OLD)
ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES)
ReturnItemCollectionMetrics: 'NONE', // optional (NONE | SIZE)
};
docClient.put(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
Welche Sprache verwenden Sie? (python, java ..) –