Auto-paginator does not work for Config Service
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone though the User Guide and the API reference
- [x] I've searched for previous similar issues and didn't find any solution
Describe the bug
Using CLIv2, auto-pagination is not working for the configservice select-aggregate-resource-config call
SDK version number
aws-cli/2.0.44 Python/3.8.5 Darwin/19.6.0 source/x86_64
Platform/OS/Hardware/Device
See above
To Reproduce (observed behavior)
In an organization/account with more than 25 instances create a config aggregator and run:
aws configservice select-aggregate-resource-config --configuration-aggregator-name <aggregator name> \
--expression "select accountId, awsRegion, resourceId where resourceType = 'AWS::EC2::Instance'"
I seem to be getting just one page back (25 results) with "NextToken" included in the response body. Issue seems to be due to missing paginator definition for this API call (SelectAggregateResourceConfig) in botocore/data/config/2014-11-12/paginators-1.json
Expected behavior
While paginating using client side pager (like "less") i would expect to see multiple calls made under the hood each following the 'NextToken' returned. The full set of results should be returned during paging.
Logs/output
2020-09-06 15:11:20,110 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.0.44 Python/3.8.5 Darwin/19.6.0 source/x86_64
2020-09-06 15:11:20,110 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['configservice', 'select-aggregate-resource-config', '--configuration-aggregator-name', '<redacted>', '--expression', "select\n accountId,\n awsRegion,\n resourceId\nwhere\n resourceType = 'AWS::EC2::Instance'", '--debug']
2020-09-06 15:11:20,110 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x10c0e45e0>
2020-09-06 15:11:20,110 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x10b99e160>
2020-09-06 15:11:20,110 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x10c1294c0>
2020-09-06 15:11:20,110 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x10b96c8b0>
2020-09-06 15:11:20,110 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x10b9c6a60>
2020-09-06 15:11:20,115 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x10bfa03a0>
2020-09-06 15:11:20,115 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x10bf51550>
2020-09-06 15:11:20,128 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /path/to/binary/awscli/2.0.44/libexec/lib/python3.8/site-packages/botocore/data/config/2014-11-12/service-2.json
2020-09-06 15:11:20,137 - MainThread - botocore.hooks - DEBUG - Event building-command-table.configservice: calling handler <function add_subscribe at 0x10bc26ca0>
2020-09-06 15:11:20,137 - MainThread - botocore.hooks - DEBUG - Event building-command-table.configservice: calling handler <function add_get_status at 0x10bc26160>
2020-09-06 15:11:20,137 - MainThread - botocore.hooks - DEBUG - Event building-command-table.configservice: calling handler <function add_waiters at 0x10c0e8c10>
2020-09-06 15:11:20,149 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('expression', <awscli.arguments.CLIArgument object at 0x10e3a0ee0>), ('configuration-aggregator-name', <awscli.arguments.CLIArgument object at 0x10e3a0f10>), ('limit', <awscli.arguments.CLIArgument object at 0x10e3a0e50>), ('max-results', <awscli.arguments.CLIArgument object at 0x10e3a0e20>), ('next-token', <awscli.arguments.CLIArgument object at 0x10e3a0dc0>)])
2020-09-06 15:11:20,149 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function add_streaming_output_arg at 0x10c0e4b80>
2020-09-06 15:11:20,149 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function add_cli_input_json at 0x10b9ca310>
2020-09-06 15:11:20,149 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function add_cli_input_yaml at 0x10b9ca5e0>
2020-09-06 15:11:20,149 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function unify_paging_params at 0x10bf52ca0>
2020-09-06 15:11:20,162 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /path/to/binary/awscli/2.0.44/libexec/lib/python3.8/site-packages/botocore/data/config/2014-11-12/paginators-1.json
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function add_generate_skeleton at 0x10c048700>
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.configservice.select-aggregate-resource-config: calling handler <function add_auto_prompt at 0x10c096f70>
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.configservice.select-aggregate-resource-config: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x10e3bb070>>
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.configservice.select-aggregate-resource-config: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x10e3bb0a0>>
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.configservice.select-aggregate-resource-config: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x10e3bb370>>
2020-09-06 15:11:20,163 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.configservice.select-aggregate-resource-config: calling handler <bound method AutoPromptArgument.override_required_args of <awscli.customizations.autoprompt.AutoPromptArgument object at 0x10e3bb1f0>>
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.expression: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.config.select-aggregate-resource-config: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10b98e6a0>
2020-09-06 15:11:20,164 - MainThread - awscli.arguments - DEBUG - Unpacked value of "select\n accountId,\n awsRegion,\n resourceId\nwhere\n resourceType = 'AWS::EC2::Instance'" for parameter "expression": "select\n accountId,\n awsRegion,\n resourceId\nwhere\n resourceType = 'AWS::EC2::Instance'"
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.configuration-aggregator-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.config.select-aggregate-resource-config: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10b98e6a0>
2020-09-06 15:11:20,164 - MainThread - awscli.arguments - DEBUG - Unpacked value of '<redacted>' for parameter "configuration_aggregator_name": '<redacted>'
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.limit: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,164 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.max-results: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.next-token: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.config.select-aggregate-resource-config.cli-auto-prompt: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10c19b970>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event calling-command.configservice.select-aggregate-resource-config: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x10e3bb070>>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event calling-command.configservice.select-aggregate-resource-config: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x10e3bb0a0>>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event calling-command.configservice.select-aggregate-resource-config: calling handler <bound method GenerateCliSkeletonArgument.generate_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x10e3bb370>>
2020-09-06 15:11:20,165 - MainThread - botocore.hooks - DEBUG - Event calling-command.configservice.select-aggregate-resource-config: calling handler <bound method AutoPromptArgument.auto_prompt_arguments of <awscli.customizations.autoprompt.AutoPromptArgument object at 0x10e3bb1f0>>
2020-09-06 15:11:20,166 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2020-09-06 15:11:20,166 - MainThread - botocore.credentials - INFO - Found credentials in environment variables.
2020-09-06 15:11:20,166 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /path/to/binary/awscli/2.0.44/libexec/lib/python3.8/site-packages/botocore/data/endpoints.json
2020-09-06 15:11:20,172 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x10b374700>
2020-09-06 15:11:20,174 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.config-service: calling handler <function add_generate_presigned_url at 0x10b340280>
2020-09-06 15:11:20,177 - MainThread - botocore.endpoint - DEBUG - Setting config timeout as (60, 60)
2020-09-06 15:11:20,178 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.config-service.SelectAggregateResourceConfig: calling handler <function base64_decode_input_blobs at 0x10c1323a0>
2020-09-06 15:11:20,178 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.config-service.SelectAggregateResourceConfig: calling handler <function generate_idempotent_uuid at 0x10b399790>
2020-09-06 15:11:20,178 - MainThread - botocore.hooks - DEBUG - Event before-call.config-service.SelectAggregateResourceConfig: calling handler <function inject_api_version_header_if_needed at 0x10b39d040>
2020-09-06 15:11:20,179 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=SelectAggregateResourceConfig) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'StarlingDoveService.SelectAggregateResourceConfig', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'aws-cli/2.0.44 Python/3.8.5 Darwin/19.6.0 source/x86_64 command/configservice.select-aggregate-resource-config'}, 'body': b'{"Expression": "select\\n accountId,\\n awsRegion,\\n resourceId\\nwhere\\n resourceType = \'AWS::EC2::Instance\'", "ConfigurationAggregatorName": "<redacted>"}', 'url': 'https://config.us-east-1.amazonaws.com/', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x10e5ed0a0>, 'has_streaming_input': False, 'auth_type': None}}
2020-09-06 15:11:20,179 - MainThread - botocore.hooks - DEBUG - Event request-created.config-service.SelectAggregateResourceConfig: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10e5ed160>>
2020-09-06 15:11:20,179 - MainThread - botocore.hooks - DEBUG - Event choose-signer.config-service.SelectAggregateResourceConfig: calling handler <function set_operation_specific_signer at 0x10b399670>
2020-09-06 15:11:20,179 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2020-09-06 15:11:20,179 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/
content-type:application/x-amz-json-1.1
host:config.us-east-1.amazonaws.com
x-amz-date:20200906T191120Z
x-amz-security-token:<redacted>
x-amz-target:StarlingDoveService.SelectAggregateResourceConfig
content-type;host;x-amz-date;x-amz-security-token;x-amz-target
<redacted>
2020-09-06 15:11:20,179 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20200906T191120Z
20200906/us-east-1/config/aws4_request
<redacted>
2020-09-06 15:11:20,180 - MainThread - botocore.auth - DEBUG - Signature:
<redacted>
2020-09-06 15:11:20,180 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://config.us-east-1.amazonaws.com/, headers={'X-Amz-Target': b'StarlingDoveService.SelectAggregateResourceConfig', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.0.44 Python/3.8.5 Darwin/19.6.0 source/x86_64 command/configservice.select-aggregate-resource-config', 'X-Amz-Date': b'20200906T191120Z', 'X-Amz-Security-Token': b'<redacted>', 'Authorization': b'AWS4-HMAC-SHA256 Credential=<redacted>/20200906/us-east-1/config/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=<redacted>', 'Content-Length': '170'}>
2020-09-06 15:11:20,180 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): config.us-east-1.amazonaws.com:443
2020-09-06 15:11:20,562 - MainThread - urllib3.connectionpool - DEBUG - https://config.us-east-1.amazonaws.com:443 "POST / HTTP/1.1" 200 3181
2020-09-06 15:11:20,563 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-RequestId': '<redacted>', 'Strict-Transport-Security': 'max-age=86400', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '3181', 'Date': 'Sun, 06 Sep 2020 19:11:19 GMT'}
2020-09-06 15:11:20,563 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"NextToken":"<redacted>","QueryInfo":{"SelectFields":[{"Name":"accountId"},{"Name":"awsRegion"},{"Name":"resourceId"}]},"Results":["<redacted 25 rows"]}'
2020-09-06 15:11:20,564 - MainThread - botocore.hooks - DEBUG - Event needs-retry.config-service.SelectAggregateResourceConfig: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x10e5edbe0>>
2020-09-06 15:11:20,564 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2020-09-06 15:11:20,564 - MainThread - botocore.hooks - DEBUG - Event after-call.config-service.SelectAggregateResourceConfig: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x10e5ed2e0>>
2020-09-06 15:11:20,568 - MainThread - awscli.formatter - DEBUG - RequestId: <redacted>
{
"Results": [
"<redacted 25 rows>"
],
"QueryInfo": {
"SelectFields": [
{
"Name": "accountId"
},
{
"Name": "awsRegion"
},
{
"Name": "resourceId"
}
]
},
"NextToken": "<redacted>"
}
Additional context
$ cat ~/.aws/config
[default]
region = us-east-1
Hi @davidaah,
As you noted, looks like the paginator is missing from the model. I'll inform the service team to add this. Thanks for reporting!
@davidaah, the team is aware of the issue and has identified how to address it. I cannot provide an ETA on when it will be added, however.
P39527425
Hi @davidaah,
This came last week as part of this commit:
https://github.com/boto/botocore/commit/80e0218b8ca84a18e6be99b586eb7810aedd7790
If you upgrade to the latest AWS CLI, this functionality should be available. Feel free to close this once you confirm that it's working for you. Thanks!
thanks... sorry for the delay, confirmed this is working!