2

I have set up a Dynamodb in my local. I can access it using cmd with commands like:

aws dynamodb list-tables --endpoint-url http://localhost:8000

And I get the list of the tables I have in my local
But when I tried to access it through the DynamoDB JavaScript Shell,
I get this result:

enter image description here

How I can access my Dynamodb local through DynamoDB JavaScript Shell?

Update: Below is the code that returns the error in the image above.

var params = {
    TableName: 'my-table',
    Limit: 10
};
dynamodb.scan(params, function(err, data) {
    if (err) ppJson(err); // an error occurred
    else ppJson(data); // successful response
});
6
  • Can you list all of the commands you have done so far. The one put above you said worked. What is the one or ones that failed? Sep 20, 2019 at 3:40
  • @Kirk, I have added the code above
    – fmsthird
    Sep 20, 2019 at 4:15
  • Are you specifying in the connection string of the code to connect to localhost:8000? Did you do the aws configure to set up the credentials and everything? Sep 26, 2019 at 2:30
  • @Kirk, yeah, I did the aws configure. where I can specify the localhost:8000?
    – fmsthird
    Sep 26, 2019 at 2:44
  • as I mentioned I can access it using the terminal but using the Dynamodb shell I get the above result
    – fmsthird
    Sep 26, 2019 at 2:48

1 Answer 1

0

You need to pass the endpoint URL to the DynamoDB constructor:

var dynamodb = new AWS.DynamoDB({endpoint: 'http://localhost:8000' })

Dynamodb constructor docs

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.