Unable to insert item to DynamoDb from command Line

0 votes

I am unable to insert item to my dynamodb table

aws dynamodb put-item --table-name PhoneBook --item '{"PhoneNo":{"S","12345"},"Name":{"S","abc"}}' --return-consumed-capacity TOTAL
Error parsing parameter '--item': Expected: '=', received: ''' for input:
'{PhoneNo:{S,12345},Name:{S,abc}}'
^

Can someone help?
 

Feb 22 in AWS by Shuvodip
73 views

2 answers to this question.

0 votes

The problem that you are facing is because of the double quotes. You have to escape the double quotes with another double quote that will help.

aws dynamodb put-item --table-name PhoneBook --item "{""PhoneNo"":{""S"",""12345""},""Name"":{""S"",""abc""}}" --return-consumed-capacity TOTAL

You will get the output as follows:

{
    "ConsumedCapacity": {
        "TableName": "PhoneBook",
        "CapacityUnits": 1.0
    }
}
answered Feb 22 by Priyaj
• 56,520 points
0 votes
Basically your command line here is unable to distinguish between double quotes and string so you require to escape the character just like you do for single slash (//). That will resolve the error. Try adding a port number for better interaction.
answered Feb 23 by Shashank
• 1,350 points

Related Questions In AWS

0 votes
2 answers

How to configure Amazon EC2 command line interface?

You can use this command to create ...READ MORE

answered Feb 23 in AWS by Shashank
• 1,350 points
75 views
0 votes
2 answers
0 votes
1 answer

Stopping then starting EC2 from command line

I understand this post is 3 years ...READ MORE

answered Aug 24, 2018 in AWS by Priyaj
• 56,520 points
48 views
0 votes
1 answer
+1 vote
2 answers
+3 votes
5 answers

How to move files from amazon ec2 to s3 bucket using command line

First Option sm3cmd Use s3cmd s3cmd get s3://AWS_S3_Bucket/dir/file Take a ...READ MORE

answered Aug 29, 2018 in AWS by Priyaj
• 56,520 points
2,093 views
0 votes
1 answer

Unable to insert record in DynamoDB using a Json file in CLI

The best practice will be: running this command ...READ MORE

answered Feb 22 in AWS by Priyaj
• 56,520 points
32 views