Querying a Local Secondary Index using the AWS SDK for PHP

Now we are going to see how to query a Local secondary index using the AWS SDK for PHP.

Getting ready

To perform this operation, you can use the IDE of your choice. To perform the query operation, you should first add items using the AWS Console or SDK, as we have seen in the earlier chapters.

How to do it…

The Query API on a Local Secondary Index is similar to the query API on a DynamoDB table. Perform the following operations in order to query the index:

  1. Instantiate the DynamoDB client for PHP. Specify the AWS region in which you would wish to create the table:
    $client = DynamoDbClient::factory(array(
        'profile' => 'default',
        'region' => 'us-west-1'  
    ));
  2. Invoke the query method from the DynamoDB ...

Get DynamoDB 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.