Skip to content

Bedrock, Knowledge Base API URL

0

Hello,

When I try to invoke /retrieveAndGenerate API, I have the error: Error: getaddrinfo ENOTFOUND bedrockruntime.us-east-2.amazonaws.com

How should look a complete API URL for AWS Bedrock, Knowledge Base (/retrieveAndGenerate) that could be used from Postman ? If the above one is good (POST https://bedrockruntime.us-east-2.amazonaws.com/retrieveAndGenerate), which is the reason of the error ?

Thank you,

asked a year ago438 views

1 Answer
0
Accepted Answer

The error you're encountering suggests there's an issue with the endpoint URL you're using. For Amazon Bedrock Knowledge Base operations like RetrieveAndGenerate, you need to use the Bedrock Agent Runtime client, not the Bedrock Runtime client.

The correct endpoint format for the RetrieveAndGenerate API should be: https://bedrock-agent-runtime.us-east-2.amazonaws.com/retrieveAndGenerate

Notice the difference: you should use bedrock-agent-runtime instead of bedrockruntime in the URL. This is because Knowledge Base operations are part of the Bedrock Agent Runtime service.

When making the POST request in Postman, ensure you:

  1. Use the correct endpoint with bedrock-agent-runtime
  2. Include proper AWS authentication headers (SigV4 signing)
  3. Set the Content-Type header to application/json
  4. Include the required JSON payload with your input text, knowledge base ID, and model ARN

The error "getaddrinfo ENOTFOUND" indicates that the DNS resolution failed because the hostname you provided doesn't exist, which confirms you were using an incorrect endpoint URL.
Sources
RetrieveAndGenerate - Amazon Bedrock
Community | Add Generative AI to a JavaScript Web App ingle page app.
Knowledge bases for Amazon Bedrock - AWS Prescriptive Guidance

answered a year ago

EXPERT

reviewed a year 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.