Skip to main content

Authentication Methods

Using AWS Access Key and Secret
  1. Create an IAM user (or choose an existing IAM user) following these steps.
  2. Add required permission for this user. The following policy grants permission to invoke all model in your available regions (To check the list of available regions for different models, refer to AWS Bedrock).
    1. The RerankModels statement is only required if you plan to use Bedrock reranker models through the Rerank API. AWS requires both bedrock:Rerank and bedrock:InvokeModel on the reranker model. Drop this statement if you are not using rerank models.
  3. Create an access key for this user as per this doc.
  4. Use this access key and secret while adding the model account to authenticate requests to the Bedrock model.
Using Assumed Role
  1. You can also directly specify a role that can be assumed by the service account attached to the pods running AI Gateway.
  2. Read more about how assumed roles work here.

Using Bedrock Guardrails

  1. Create a Guardrail in AWS. More information at this link - https://aws.amazon.com/bedrock/guardrails
  2. Copy the Guardrails ID and the version number
  3. While calling a AWS bedrock model through TFY AI Gateway, pass the following object along with it:
  4. This should ensure the response will have guardrails enforced. Consider this input where the guardrail is configured to censor PII like name, email etc.:
  5. Sample output:
  6. If you’re using a library like Langchain, you might have to pass the extra param in a parameter like extra_body as required by the library. For example, refer this Langchain OpenAI class doc.