Reading items

We can read items using get-item, query, or scan:

  1. Use the aws dynamodb get-item CLI command, passing all key fields:
aws dynamodb get-item \    --table-name my_table \    --key '{"id":{"S":"002"},"datetime":{"N":"1536898295"}}' \    --return-consumed-capacity TOTAL \    --region us-east-1    --profile admin

This command will return a single item, along with metadata describing the result. The result part returned is shown in the following screenshot:

The metadata part is shown in the following screenshot:

I had added the return-consumed-capacity ...

Get Serverless Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.