DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell

Publicado el: 23 enero 2021
en el canal de: Kashafunnisa Bagewadi
2,173
27

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


En esta página del sitio puede ver el video en línea DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell de Duración hora minuto segunda en buena calidad , que subió el usuario Kashafunnisa Bagewadi 23 enero 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,173 veces y le gustó 27 a los espectadores. Disfruta viendo!