Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autopagination not working #147

Closed
lgaudreau opened this issue Apr 16, 2020 · 6 comments
Closed

Autopagination not working #147

lgaudreau opened this issue Apr 16, 2020 · 6 comments
Labels

Comments

@lgaudreau
Copy link

While running a command like 'get-ec2snapshot' in a region where there are more than 1000 snapshots, the command fails with

Get-EC2Snapshot: You have exceeded the output limit for an unpaginated response. Retry your request using pagination parameters.

Running with -maxresults returns a warning that the command is deprecated, but the solution presented (to pipe the results to Select-Object -First ##) also fails since it requires returning all objects first.

This was not happening in AWSPowerShell 3.3.563.1 at least.

@matteo-prosperi matteo-prosperi added the bug This issue is a bug. label Apr 16, 2020
@matteo-prosperi
Copy link
Contributor

I think this can be fixed by setting a default value of 1000 for -MaxResult. I will mark this as a bug.

I believe previous versions of the module are similarly affected, they would just return a partial output without complaining. You should be able to restore this behavior by passing -MaxResult 1000 and ignoring the warning.

Information for the implementer of the fix: AWS.Tools will have a different behavior and should be tested as well.

@lgaudreau
Copy link
Author

I've installed AWS.Tools version 4.0.5.0 and have run into the following behaviour:

With 15,000 snapshots in the account, running 'Get-EC2Snapshot -Owner self' returns the same error:
Get-EC2Snapshot: You have exceeded the output limit for an unpaginated response. Retry your request using pagination parameters.
Using -MaxResult 1000 returns the first 1000, but setting -NextToken is not working as expected either - the second run only returns 467 items, not another 1000.

@ashishdhingra ashishdhingra added module/powershell-cmdlets needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2020
@ashishdhingra
Copy link
Contributor

Hi @lgaudreau,

Good afternoon.

I was going through the issue backlog and came across the issue. The -NextToken appears to work fine for me:

Get-EC2Snapshot -MaxResult 10 -NextToken $null 
Get-EC2Snapshot -MaxResult 10 -NextToken $AWSHistory.LastServiceResponse.NextToken

Output of Get-InstalledModule | Select Version,Name

Version Name
------- ----
4.1.2.0 AWS.Tools.EC2
4.1.2.0 AWS.Tools.IdentityManagement
4.1.2.0 AWS.Tools.Glacier
4.1.2.0 AWS.Tools.S3
4.1.2.0 AWS.Tools.SQS
4.1.2.0 AWS.Tools.Common
4.1.2.0 AWS.Tools.SimpleNotificationService
4.1.2.0 AWSPowerShell
1.0.2.0 AWS.Tools.Installer
2.0.0.0 AWSLambdaPSCore
4.1.2.0 AWSPowerShell.NetCore

Output of Get-AWSPowerShellVersion

AWS Tools for Windows PowerShell
Version 3.3.119.0
Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET
Core Runtime Version 3.3.17.0
Copyright 2009-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws.amazon.com/releasenotes/PowerShell

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License
[http://logging.apache.org/log4net/license.html]

Please try with the latest version of Powershell Tools/Modules and confirm if the issue is resolved.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 14, 2020
@lgaudreau
Copy link
Author

lgaudreau commented Oct 14, 2020 via email

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 15, 2020
@ashishdhingra
Copy link
Contributor

Hi @lgaudreau,

Thanks for your reply. I think we already have a feature request #117 to support auto-pagination for AWS.Tools.*. Please confirm if we close this issue in favor of the other feature request.

Thanks,
Ashish

@ashishdhingra ashishdhingra added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 15, 2020
@lgaudreau
Copy link
Author

lgaudreau commented Oct 15, 2020 via email

@ashishdhingra ashishdhingra removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants