boto3 icon indicating copy to clipboard operation
boto3 copied to clipboard

RDS describe_db_instances paginator has incorrect PaginationConfig description

Open corey-cole opened this issue 2 years ago • 1 comments

Describe the issue

The documentation states:

MaxItems (integer) –

The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

The correct parameter for pagination is actually PageSize. Additionally, the value of PageSize has non-obvious constraints. Setting the parameter to 1 (as is frequently done for testing the boto3 documentation) results in an InvalidParameterValue exception.

Per the underlying API documentation (link also provided below), this value must be between 20 and 100, and has a default value of 100.

Finally, the next token marker in the documentation is incorrect. The boto3 documentation states that a key of NextToken will be present in the response. However, the API documentation and the mypy stubs for this service both indicate that the correct key is Marker.

Links

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds/paginator/DescribeDBInstances.html

https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html

corey-cole avatar Jul 26 '23 18:07 corey-cole

Hi @corey-cole thanks for reaching out. It looks like this overlaps with the tracking issue we created for the other paginator issues you opened: https://github.com/boto/boto3/issues/3677

I'm going to share a code snippet highlighting the issue you're describing here:

import boto3
client = boto3.client('rds')

paginator = client.get_paginator('describe_db_instances')

response_iterator = paginator.paginate(
    PaginationConfig={
        'PageSize': 5,
        'StartingToken': 'string'
    }
)

Results in: botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeDBInstances operation: Invalid value 5 for MaxRecords. Must be between 20 and 100

We may want to consider tracking this in https://github.com/boto/boto3/issues/3677 as well, but pending further review I'll leave this open as separate issue.

tim-finnigan avatar Jul 28 '23 22:07 tim-finnigan