Posted On: Mar 29, 2021

AWS Config advanced queries feature now supports pagination for queries that contain aggregate functions, such as COUNT and SUM. For example, getting the total number of resources in each AWS account requires the COUNT aggregate function. You can now use advanced queries to get complete results for your aggregate queries through pagination, which were previously limited to 500 rows. Pagination is a technique that is used to divide large results into “pages,” where each page contains a subset of results. You can process the first page of results, then the second page, and so on.

The AWS Config advanced query feature lets you query the current configuration state of your AWS resources based on configuration properties for a single account and AWS Region, or multiple accounts and AWS Regions in supported Regions. You can either select one of the sample queries or write your own custom query to retrieve information about your specific use cases. For example, by running one of the sample queries provided in the advanced query feature, you can identify all EBS volumes across your organization that are not attached to any EC2 instance.

You can get the paginated results for your aggregate queries using the AWS Config console or APIs. To get started, open the AWS Config console, and navigate to Advanced queries. You can write a query that contains an aggregate function in the query editor, and choose the Run button. You can review the results in the Output section. To get the full paginated results through APIs, you can use the NextToken parameter of SelectResourceConfig and SelectAggregateResourceConfig APIs.

Pagination support for AWS Config advanced queries with aggregate functions is available at no additional cost to AWS Config customers in AWS Regions listed here. For more information about AWS Config, see the AWS Config webpage and the AWS Config Developer Guide.