1

I am very new to aws. I was trying to create a database table by running following command: ``

aws dynamodb create-table --table-name pizza-order --attribute-definitions AttributeName=orderId, AttributeType=S --key-schema AttributeName=orderId,keyType=HASH --provisioned-throughput ReadCapacityUnit=1,WriteCapacityUnit=1 --region us-east-2  --query TableDescription.TableArn --output text
``

But I am getting a error like this: Error parsing parameter '--attribute-definitions': Expected: '', received: '' for input: AttributeName=orderId,

1
  • AttributeName=orderId, AttributeType=S, can you remove the space between orderId and AttributeType and its KeyType,and ReadCapacityUnits same goes for WriteCapacityUnits and why are you using --query TableDescription.TableArn --output text what you want to achieve with ``query option Commented Apr 21, 2021 at 3:44

2 Answers 2

3

The command works with following modifications:

  • Remove space after orderId,
  • KeyType correctly capitalized
  • ReadCapacityUnits and WriteCapacityUnits correctly pluralized.

Here is the working command for your reference:

aws dynamodb create-table --table-name pizza-order --attribute-definitions AttributeName=orderId,AttributeType=S --key-schema AttributeName=orderId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --region us-east-2 --query TableDescription.TableArn --output text

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

2 Comments

after dong that it gives following error. can u tell me what to do!? 😀 An error occurred (AccessDeniedException) when calling the CreateTable operation: User: arn:aws:iam::676374644948:user/suraiya_moon126 is not authorized to perform: dynamodb:CreateTable on resource: arn:aws:dynamodb:us-east-2:676374644948:table/pizza-order
you need to atach a policy to your Iam user by going to users in iam -> under permission add permissions -> attach existing policies directly -. search for dynamodb full access and add it :)
1
aws dynamodb create-table --table-name pizza-order --attribute-definitions AttributeName=orderId,AttributeType=S --key-schema AttributeName=orderId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --region us-east-2 --query TableDescription.TableArn --output text

Docs for reference https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/getting-started-step-1.html

To verify that DynamoDB has finished creating the Music table, use the describe-table command.

 aws dynamodb describe-table --table-name pizza-order | grep TableStatus

This command returns the following result. When DynamoDB finishes creating the table, the value of the TableStatus field is set to ACTIVE.

"TableStatus": "ACTIVE",

note:- whenever you are stuck or want to know the details of the command its a good practice to check aws cli doc for particular API for create table

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.