HEX
Server: LiteSpeed
System: Linux ip-172-31-76-142.ec2.internal 4.14.158-129.185.amzn2.x86_64 #1 SMP Tue Dec 24 03:15:32 UTC 2019 x86_64
User: 69b4844ae61d4e92bf26ad98af552775 (1065)
PHP: 7.2.27
Disabled: exec,passthru,shell_exec,system,eval
Upload Files
File: //proc/thread-self/root/lib/python2.7/site-packages/awscli/examples/dynamodb/batch-get-item.rst
**To retrieve multiple items from a table**

This example reads multiple items from the *MusicCollection* table using a batch of three GetItem requests.  Only the *AlbumTitle* attribute is returned.

Command::

  aws dynamodb batch-get-item --request-items file://request-items.json

The arguments for ``--request-items`` are stored in a JSON file, ``request-items.json``.  Here are the contents of that file::

  {
      "MusicCollection": {
          "Keys": [
              {
                  "Artist": {"S": "No One You Know"},
                  "SongTitle": {"S": "Call Me Today"}
              },
              {
                  "Artist": {"S": "Acme Band"},
                  "SongTitle": {"S": "Happy Day"}
              },
              {
                  "Artist": {"S": "No One You Know"},
                  "SongTitle": {"S": "Scared of My Shadow"}
              }
          ],
          "ProjectionExpression":"AlbumTitle"
      }
  }

Output::

  {
      "UnprocessedKeys": {}, 
      "Responses": {
          "MusicCollection": [
              {
                  "AlbumTitle": {
                      "S": "Somewhat Famous"
                  }
              }, 
              {
                  "AlbumTitle": {
                      "S": "Blue Sky Blues"
                  }
              }, 
              {
                  "AlbumTitle": {
                      "S": "Louder Than Ever"
                  }
              }
          ]
      }
  }