0

I was just learning AWS DynamoDB in CLI. i was specifically performing put-item using command aws dynamodb put-item --table-name new --item file://item.json. I have successfully configured the IAM credentials and I'm also able to get the responce back using aws dynamodb list-tables :

{ "TableNames": [ "new", "test" ] }

ERROR:

Validation Error

I'm specifically this error: An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Missing the key newid in the item

can anyone please guide me how to get out of this and fix this error?

4
  • What is your partition key? Commented Dec 23, 2019 at 14:57
  • @krishna_mee2004 test_id (String) Commented Dec 23, 2019 at 15:14
  • @krishna_mee2004 Yureka. i got it thanks for giving hint Commented Dec 23, 2019 at 15:58
  • In case you need it, there are examples of this in the getting started section of the DynamoDB documentation for CLI and most SDKs. Commented Dec 23, 2019 at 20:00

1 Answer 1

2

Ok i was the one who asked this question and thanks to @krishna_mee2004 for giving hint to my problem. the main issue was that i had specified partition key as test_id and i was using it as user_id.

my previous format in item.json was

    {
    "user_id":{"S":"123add"},
    "ForumName": {"S": "Amazon DynamoDB"},
    "Subject": {"S": "New discussion thread"},
    "Message": {"S": "First post in this thread"},
    "LastPostedBy": {"S": "[email protected]"},
    "LastPostDateTime": {"S": "201603190422"}
}

but i just replaced user_id with test_id:

   {
    "test_id":{"S":"123add"},
    "ForumName": {"S": "Amazon DynamoDB"},
    "Subject": {"S": "New discussion thread"},
    "Message": {"S": "First post in this thread"},
    "LastPostedBy": {"S": "[email protected]"},
    "LastPostDateTime": {"S": "201603190422"}
}

which was the actual partition key of my AWS DynamoDB table and voila it worked:

i Successfully created a table list:

enter image description here

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.