I'm attempting to use get_resources from the resourcesgrouptaggingAPI and paginate it. I'm doing this with a lambda function and boto3.
However, using base = client.can_paginate('get_resources')
returns False
although within the documentation it suggests that it works for get_resources
.
Another person had this problem and created an issue of it here. Now It seems to work for him, so I am trying to investigate what would cause the console lambda environment to not work.
Just for clarity is here is my declaration and initialization:
client = boto3.client('resourcegroupstaggingapi')
base = client.can_paginate('get_resources') #returns False
paginator = client.get_paginator('get_resources')
Thus, is there a problem with using the console for pagination?
The AWS lambda environment isn't always running the most up to date version of boto3/botocore. It currently offers botocore version 1.5.52
(source: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html ). The paginator you're trying to access was released in 1.5.53 (source: https://github.com/boto/botocore/commit/144dda7b63f9eccaeae66c040a281208b43e2678 )
As such you're attempting to use a version of botocore where pagination of get_resources
isn't yet supported. In this case you need to bundle a version of boto3/botocore which supports that functionality with your lambda by installing before bundling.
E.g. if your source code was in the directory src:
pip install boto3==1.4.4
cp -r /usr/local/lib/python2.7/site-packages/* src/
cd src
zip -rq lambda.zip .