DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell

Publié le: 23 janvier 2021
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Kashafunnisa Bagewadi 23 janvier 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,173 fois et il a aimé 27 téléspectateurs. Bon visionnage!