Merge pull request #106280 from nckturner/max-results

[AWS] Set max results if its not set
This commit is contained in:
Kubernetes Prow Robot 2021-12-28 10:47:56 -08:00 committed by GitHub
commit f5be5052e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -960,6 +960,13 @@ func (s *awsSdkEC2) DescribeInstances(request *ec2.DescribeInstancesInput) ([]*e
results := []*ec2.Instance{}
var nextToken *string
requestTime := time.Now()
if request.MaxResults == nil && request.InstanceIds == nil {
// MaxResults must be set in order for pagination to work
// MaxResults cannot be set with InstanceIds
request.MaxResults = aws.Int64(1000)
}
for {
response, err := s.ec2.DescribeInstances(request)
if err != nil {