I'm following the instructions in the AWS developer guide tutorial and just changed the names of the attributes. I can't seem to make the INSERT INTO tablename VALUE
statement work.
I created the table resourceLock
& ensured it was fully created (TableStatus
= ACTIVE
):
aws dynamodb create-table --profile free --output table \
--table-name resourceLock \
--attribute-definitions \
AttributeName=resourceType,AttributeType=S \
AttributeName=resourceName,AttributeType=S \
--key-schema \
AttributeName=resourceType,KeyType=HASH \
AttributeName=resourceName,KeyType=RANGE \
--billing-mode=PAY_PER_REQUEST \
--table-class=STANDARD \
Then, I tried to run the below statement:
aws dynamodb execute-statement --statement "INSERT INTO resourcelock VALUE {'resourceName':'dev', 'resourceType':'environment'}" --profile free
Which gave me the error:
An error occurred (ResourceNotFoundException) when calling the ExecuteStatement operation: Requested resource not found
I've tried a number of variations on the syntax but I can't seem to get it to work from the cli.
I can add items via the AWS Console so not sure what's wrong.
A table is created with the name resourceLock
(upper-case L), but the execute-statement
command is using resourcelock
(lower-case L).
Table names are case-sensitive in DynamoDB, so this should work:
aws dynamodb execute-statement --statement "INSERT INTO resourceLock VALUE {'resourceName':'dev', 'resourceType':'environment'}" --profile free