This video is about DynamoDB CRUD operations using local DynamoDB web shell. In this video I explained about:
1. How to run DynamoDB web shell on local machine free of cost.
2. Explained and executed DynaomDB commands like listTables, createTable, putItem, getItem, deleteItem and deleteTable etc.
You can find all those commands here:
// to run the DynamoDB local:
// java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar
// Run the web shell on: http://localhost:8000/shell/
// Create table
var params1 = {
TableName: 'book',
AttributeDefinitions: [{
AttributeName: 'title',
AttributeType: 'S'
},
{
AttributeName: 'auther',
AttributeType: 'S'
}],
KeySchema: [{
AttributeName: 'title',
KeyType: 'HASH'
},
{
AttributeName: 'auther',
KeyType: 'RANGE'
}],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1
},
}
dynamodb.createTable(params1, function(err, data){
if(err){
console.log("Error: "+err)
}else{
console.log("Table created: "+JSON.stringify(data))
}
});
// List the tables
dynamodb.listTables({Limit: 10}, function(err, data) {
if (err) {
console.log("Error", err.code);
} else {
console.log("Table names are ", data.TableNames);
}
});
// Describe the table
dynamodb.describeTable({TableName: 'book'}, function(err, data){
if(err){
console.log(err)
}else{
console.log("Table description: "+JSON.stringify(data));
}
});
// Add item
var params2 = {
TableName: 'book',
Item: {
title: {'S': 'You are born to Blossom'},
auther: {'S': 'APJ Abdul Kalam'},
price: {'N': '186'}
}
};
dynamodb.putItem(params2, function(err, data){
if(err){
console.log("Error: "+err)
}else{
console.log("Item Added: "+JSON.stringify(data));
}
});
// Get Item
var params3 = {
TableName: 'book',
Key: {
title: { 'S': 'You are born to Blossom'},
auther: { 'S': 'APJ Abdul Kalam'}
}
}
dynamodb.getItem(params3, function(err, data){
if(err){
console.log("Error: "+err)
}else{
console.log("Item Got: "+JSON.stringify(data.Item));
}
});
// Delete Item
dynamodb.deleteItem(params3, function(err, data){
if(err){
console.log("Error: "+err)
}else{
console.log("Item Deleted: "+data)
}
});
#awscloud #dynamodb #webshell #javascript #crud
On this page of the site you can watch the video online DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell with a duration of hours minute second in good quality, which was uploaded by the user Kashafunnisa Bagewadi 23 January 2021, share the link with friends and acquaintances, this video has already been watched 2,173 times on youtube and it was liked by 27 viewers. Enjoy your viewing!