I'm trying to compete the Node js amazon start guide with DynamoDB. I'm trying to create a table but here is the error I've :
Unable to create table. Error JSON: {
"message": "Unexpected token h",
"code": "SyntaxError",
"time": "2016-05-06T16:59:50.411Z",
"statusCode": 200,
"retryable": false,
"retryDelay": 0
I'm running the following node (taken directly from amazon start guide) :
var AWS = require("aws-sdk");
AWS.config.loadFromPath('./.aws/credentials.json');
AWS.config.update({
region: "us-west-2",
endpoint: "http://localhost:8000"
});
var dynamodb = new AWS.DynamoDB();
var params = {
TableName : "Movies",
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));
}
});
I've run a local web server on port 8080 based on this tutorial : https://www.youtube.com/watch?v=pU9Q6oiQNd0. It seems to be working fine.
Thanks.
./.aws/credentials.jsonis valid JSON (double quoted property names, etc.)