1

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!

1 Answer 1

2

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 [ ..... ]

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

3 Comments

Thanks. I made the changes to the json. Now I'm getting the error Unknown options: --table-name, Sensors . The table exists, so is it not recognizing my cl input? I'm using the same command as above.
Are you sure you are using the right Region? Check the region where the table is
Make sure you define --region and --profile (if you use non default credential profile) correctly

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.