amazon-web-servicesaws-lambdaamazon-dynamodbputdynamo-local

How to resolve the issue of (ValidationException) in AWS DynamoDB while working with CLI?


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?


Solution

  • 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": "fred@example.com"},
        "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": "fred@example.com"},
        "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