EC2 API request failed retry again Reason was – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.5

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

Briefly, this error occurs when Elasticsearch fails to communicate with the Amazon EC2 API. This could be due to network issues, incorrect configuration, or insufficient permissions. To resolve this, you can check your network connectivity, ensure that your AWS credentials are correctly configured in Elasticsearch, and verify that your IAM role has the necessary permissions to access the EC2 API. Additionally, you can also increase the retry limit in your Elasticsearch settings to handle temporary network issues.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” EC2 API request failed; retry again. Reason was: ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: discovery, discovery-ec2, request, plugins.

Log Context

Log “EC2 API request failed; retry again. Reason was:” classname is AwsEc2ServiceImpl.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        final Random rand = Randomness.get();
        final RetryPolicy retryPolicy = new RetryPolicy(
            RetryPolicy.RetryCondition.NO_RETRY_CONDITION;
            (originalRequest; exception; retriesAttempted) -> {
               // with 10 retries the max delay time is 320s/320000ms (10 * 2^5 * 1 * 1000)
               logger.warn("EC2 API request failed; retry again. Reason was:"; exception);
               return 1000L * (long) (10d * Math.pow(2; retriesAttempted / 2.0d) * (1.0d + rand.nextDouble()));
            };
            10;
            false);
        clientConfiguration.setRetryPolicy(retryPolicy);

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?