2021年1月16日星期六

Is there a way to GET all items in a global secondary index with REST API using aws api-gateway? I can only GET some

I created a REST api using aws api-gateway and dynamodb without using aws-lambda (I wrote mapping templates for both the integration request and integration response instead of lambda) on a GET API method, POST http method and Scan action setting. I'm fetching from a global secondary index in dynamodb to make my scan smaller than the original table.

It's working well except I am only able to scan roughly 1,000 of my 7,500 items that I need to scan. I checked out paginating the json in an s3 bucket, but I really want to keep it simple with just the aws api-gateway and the dynamodb, if possible.

Is there a way to get all 7,500 of the items in my payload with some modification to my integration request and/or response mappings? If not, what do you suggest?

Below is the mapping code I'm using that works for a 1000 item json payload instead of the 7,500 that I would like to have:

Integration Request:

{     "TableName": "TrailData",    "IndexName": "trail-index"  }  

Integration Response:

  #set($inputRoot = $input.path('$'))    [     #foreach($elem in $inputRoot.Items)        {          "id":$elem.id.N,         "trail_name":"$elem.trail_name.S",         "challenge_rank":$elem.challenge_rank.N,         "challenge_description":"$elem.challenge_description.S",         "reliability_description":"$elem.reliability_description.S"         }         #if($foreach.hasNext),

没有评论:

发表评论