The documentation can be a bit difficult to understand. Since you are using the dynamodb shell, I'll assume you are asking for a JavaScript query to create the table.
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
});
Run the above snippet in the browser at the local db shell
http://localhost:8000/shell/
It creates a table with 'sid' as hash key.
To insert:
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
});
tutorial.start()
. It's been really helpful. – christo8989