Skip to content

OpenSearchException: Request failed: [http_exception] server returned 504

0

I have a small single OpenSearch instance t3.medium. I get error when I try to connect:

Caused by: org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [http_exception] server returned 504 at org.opensearch.client.transport.aws.AwsSdk2Transport.parseResponse(AwsSdk2Transport.java:596) ~[opensearch-java-3.3.0.jar:na]

How I can solve the issue?

asked 10 months ago122 views

1 Answer
1

The 504 error you're experiencing with your OpenSearch instance suggests a gateway timeout issue. This could be caused by several factors:

  1. Connectivity Issues: Ensure your OpenSearch domain is properly configured for access. If it's publicly accessible, verify the security group settings allow traffic from your client's IP address.

  2. Authentication/Authorization Problems: Verify that you have the correct permissions to access the OpenSearch domain. You might need to:

  • Create appropriate IAM roles with necessary permissions
  • Set up proper role mappings if using fine-grained access control
  1. Client Configuration: Check your client configuration:
  • Ensure you're using the correct endpoint URL
  • Verify your AWS credentials are properly configured
  • Consider implementing a request signer for AWS authentication
  1. Resource Constraints: Your t3.medium instance might be under resource pressure:
  • Check CloudWatch metrics for high CPU utilization or memory pressure
  • Monitor for JVM heap usage issues
  • Consider enabling error logs in CloudWatch to get more detailed information about the errors
  1. Request Timeout: The client request might be timing out before the server can respond:
  • Increase client timeout settings
  • Optimize your queries if they're too complex

If you've enabled CloudWatch logging for your OpenSearch domain, check the error logs for more specific information about what's causing the 504 error. The logs would contain WARN, ERROR, or FATAL level messages that could provide more insight into the specific issue.
Sources
Community | Build GenAI Apps with Golang and Amazon Bedrock
Monitoring OpenSearch logs with Amazon CloudWatch Logs - Amazon OpenSearch Service

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.