Zack Lutz
Zack Lutz

Reputation: 43

AWS DynamoDB Issues adding values to existing table

I have already created a table called Sensors and identified Sensor as the hash key. I am trying to add to the table with my .json file. The items in my file look like this:

{
  "Sensor": "Room Sensor",
  "SensorDescription": "Turns on lights when person walks into room",
  "ImageFile": "rmSensor.jpeg",
  "SampleRate": "1000",
  "Locations": "Baltimore, MD"
}
{
  "Sensor": "Front Porch Sensor",
  "SensorDescription": " ",
  "ImageFile": "fpSensor.jpeg",
  "SampleRate": "2000",
  "Locations": "Los Angeles, CA"
}

There's 20 different sensors in the file. I was using the following command:

aws dynamodb batch-write-item \
--table-name Sensors \
--request-items file://sensorList.json \
--returned-consumed-capacity TOTAL

I get the following error:

Error parsing parameter '--request-items': Invalid JSON: Extra data: line 9 column 1 (char 189)

I've tried adding --table name Sensors to the cl and it says Unknown options: --table-name, Sensors. I've tried put-item and a few others. I am trying to understand what my errors are, what I need to change in my .json if anything, and what I need to change in my cl. Thanks!

Upvotes: 1

Views: 180

Answers (1)

Perimosh
Perimosh

Reputation: 2824

Your input file is not a valid json. You are missing a comma to separate both objects, and you need to enclose everything with brackets [ ..... ]

Upvotes: 2

Related Questions