Gean Ribeiro
Gean Ribeiro

Reputation: 1035

Delete Item on DynamoDB CLI localhost

I have a DynamoDB's Table called "ZombieSession" and the "SessionId" primary key with "S" type.

The local service is running in http://localhost:8181.

For local tests, I'm trying execute these commands:

(1)

aws dynamodb delete-item --table-name ZombieSession --key '4ae40a08-007c-4785-babd-caff0ed12d1d' --endpoint-url http://localhost:8181 --region us-east-1

That results in:

Error parsing parameter '--key': Invalid JSON: '4ae40a08-007c-4785-babd-caff0ed12d1d'

and

(2)

aws dynamodb delete-item --table-name ZombieSession --key '{"SessionId":{"S":"4ae40a08-007c-4785-babd-caff0ed12d1d"}}' --endpoint-url http://localhost:8181 --region us-east-1

That results in:

Error parsing parameter '--key': Invalid JSON: '{SessionId:{S:4ae40a08-007c-4785-babd-caff0ed12d1d}}'

I don't found any documentation example about this.

What's the appropriate command for this operation?

Upvotes: 0

Views: 7582

Answers (1)

Gean Ribeiro
Gean Ribeiro

Reputation: 1035

I discovered that the value of --key parameter need have the quotation mark with escape:

aws dynamodb delete-item --table-name ZombieSession --key "{\"SessionId\":{\"S\":\"4ae40a08-007c-4785-babd-caff0ed12d1d\"}}" --endpoint-url http://localhost:8181 --region us-east-1

Upvotes: 11

Related Questions