DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell

Publicado em: 23 Janeiro 2021
no 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


Nesta página do site você pode assistir ao vídeo on-line DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Kashafunnisa Bagewadi 23 Janeiro 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,173 vezes e gostou 27 espectadores. Boa visualização!