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, 2019 in AWS by Shuvodip
4,130 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, 2019 by Priyaj
• 58,020 points
Thank you very much. Got it now.
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, 2019 by Shashank
• 1,370 points

Related Questions In AWS

+1 vote
1 answer

How to find all instance Ids In AWS from command line?

Hi@akhtar, You can find one keyword --query in ...READ MORE

answered Jun 2, 2020 in AWS by MD
• 95,460 points
5,577 views
–1 vote
1 answer

How to find AWS instance Ids in yaml format from command line?

Hi@akhtar, By default AWS gives output in json ...READ MORE

answered Jun 2, 2020 in AWS by MD
• 95,460 points
795 views
0 votes
1 answer

How to check the state of the snapshot from the command line in AWS?

Hi@akhtar, You can check the state of the snapshot ...READ MORE

answered Oct 20, 2020 in AWS by MD
• 95,460 points
1,319 views
0 votes
1 answer
+1 vote
2 answers
+3 votes
6 answers

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

Hey, 3 ways you can do this: To ...READ MORE

answered Oct 9, 2018 in AWS by Omkar
• 69,220 points
20,003 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, 2019 in AWS by Priyaj
• 58,020 points
1,789 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP