2

I am trying to set up a dynamodb table on my raspberry pi but am running into a strange network issue.

pi@raspberrypi:~/Casty/InitDynamoDB $ node CreateMovieListTable.js 
Adding a new item...
Unable to add item. Error JSON: {
    "message": "connect ECONNREFUSED",
    "code": "NetworkingError",
    "errno": "ECONNREFUSED",
    "syscall": "connect",
    "region": "us-west-2",
    "hostname": "localhost",
    "retryable": true,
    "time": "2016-07-03T00:18:18.983Z"
}

I am able to ping localhost and the pi is connected to wifi. Does anyone have any idea what is going on? Below is the code I am using to create the table. Thank you very much.

var AWS = require("aws-sdk");

AWS.config.update({
  region: "us-west-2",
  endpoint: "http://localhost:8000"
});

var dynamodb = new AWS.DynamoDB();

var params = {
    TableName : "MovieList",
    KeySchema: [
        { AttributeName: "year", KeyType: "HASH"},  //Partition key
        { AttributeName: "title", KeyType: "RANGE" }  //Sort key
    ],
    AttributeDefinitions: [
        { AttributeName: "year", AttributeType: "N" },
        { AttributeName: "title", AttributeType: "S" }
    ],
    ProvisionedThroughput: {
        ReadCapacityUnits: 10,
        WriteCapacityUnits: 10
    }
};

dynamodb.createTable(params, function(err, data) {
    if (err) {
        console.error("Unable to create table. Error JSON:", JSON.stringify(err, null, 2));
    } else {
        console.log("Created table. Table description JSON:", JSON.stringify(data, null, 2));
    }
});
0

1 Answer 1

1

Perhaps

"You need to change the endpoint in your application in order to use the Amazon DynamoDB service."

AWS.config.update({endpoint: "https://dynamodb.us-west-2.amazonaws.com"});

Reference: http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/GettingStarted.NodeJs.Summary.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.