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

[Feature Request] DescribeImagesPaginator or ListImages of Ec2Client #1592

Closed
cielong opened this issue Jan 15, 2020 · 2 comments
Closed

[Feature Request] DescribeImagesPaginator or ListImages of Ec2Client #1592

cielong opened this issue Jan 15, 2020 · 2 comments
Labels
feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@cielong
Copy link

cielong commented Jan 15, 2020

The describeImages() method of the Ec2Client takes too much time and without any filters, it throws read timeout exception.
In my case, I want to retrieve all the ids of available images given account and region and I don't care about the filters since I don't want to narrow down the range.
Since there's no api to directly retrieve all the ids and thus I have to work around it using the describeImages(), as follows,

        DescribeImagesResponse response = awsClientFactory
                .getEC2Client(accessKey, secretKey, region)
                .describeImages();

        List<String> items = response.images().stream()
                .map(Image::imageId)
                .collect(Collectors.toList());

However, using this I received timeout exception after long time waiting, this just makes no sense for me that there's no pagination, no way to specify the limit number and no way to get only some fields of all the images directly through api.
The error are as follows.

Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Read timed out
at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.handleThrownException(RetryableStage.java:136)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.execute(RetryableStage.java:94)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:62)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:57)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:37)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:240)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:96)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:120)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:73)
at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:44)
at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:55)
at software.amazon.awssdk.services.ec2.DefaultEc2Client.describeImages(DefaultEc2Client.java:9360)
at software.amazon.awssdk.services.ec2.Ec2Client.describeImages(Ec2Client.java:16715)

@debora-ito
Copy link
Member

Hi @cielong, I'll pass your feature request over to the service team behind the EC2 API.

In the meantime you can try to change the value of connection timeout - https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/section-client-configuration.html#http-transport-configuration

Let us know if that helps.

@debora-ito debora-ito added feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation. closing-soon This issue will close in 4 days unless further comments are made. and removed closing-soon This issue will close in 4 days unless further comments are made. labels Jan 16, 2020
@debora-ito
Copy link
Member

The EC2 team added the feature request to their backlog, so I'll go ahead and close this. Feel free to reach out if you have any other question.

aws-sdk-java-automation added a commit that referenced this issue Aug 6, 2021
…fe3201dde

Pull request: release <- staging/20132ea1-1807-41b0-aada-c78fe3201dde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants