DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell

Pubblicato il: 23 gennaio 2021
sul canale di: 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


In questa pagina del sito puoi guardare il video online DynamoDB Web Shell - CRUD Operations using local DynamoDB JavaScript Shell della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Kashafunnisa Bagewadi 23 gennaio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,173 volte e gli è piaciuto 27 spettatori. Buona visione!