Amazon Bedrock Integration
This guide walks you through integrating Amazon Bedrock with NudgeBee's LLM Server and RAG Server applications.
Overview
Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies through a unified API. Bedrock simplifies the process of building generative AI applications while maintaining privacy and security.
Prerequisites
- AWS account with Amazon Bedrock access enabled
- IAM user with appropriate Bedrock permissions
- AWS Access Key ID and Secret Access Key
Setting up Amazon Bedrock Credentials
-
Request Access to Models:
- Navigate to the Amazon Bedrock console in AWS
- Go to "Model access" in the navigation pane
- Request access to the foundation models you want to use
- Wait for approval (typically immediate for most models)
-
Create IAM User with Bedrock Permissions:
aws iam create-user --user-name bedrock-userAttach one of the following policies to grant Bedrock access:
Option A: Custom Inline Policy (Recommended — Least Privilege)
Create a policy file
bedrock-policy.json:{"Version": "2012-10-17","Statement": [{"Sid": "VisualEditor0","Effect": "Allow","Action": ["bedrock:InvokeModel","bedrock:InvokeModelWithResponseStream"],"Resource": "*"}]}Attach the inline policy:
aws iam put-user-policy --user-name bedrock-user --policy-name BedrockInvokeAccess --policy-document file://bedrock-policy.jsonOption B: AWS Managed Policy
aws iam attach-user-policy --user-name bedrock-user --policy-arn arn:aws:iam::aws:policy/AmazonBedrockLimitedAccess -
Generate Access Keys:
aws iam create-access-key --user-name bedrock-userSave the returned Access Key ID and Secret Access Key securely.
Model ID vs Inference Profile
When calling models on Amazon Bedrock, the model name you provide depends on your throughput setup:
-
Inference Profile (default): If you have not purchased dedicated/provisioned throughput, you can use an inference profile ID (recommended) or a bare model ID as the model name. Inference profiles are prefixed with the region shorthand (e.g.,
us.,eu.).- Example LLM (Meta Llama):
us.meta.llama3-8b-instruct-v1:0 - Example LLM (Anthropic Claude):
us.anthropic.claude-3-5-sonnet-20241022-v2:0 - Example Embeddings:
us.amazon.titan-embed-text-v2:0 - You can find available inference profile IDs in the Bedrock console under Inference profiles, or by running:
aws bedrock list-inference-profiles --region <your-region>
- Example LLM (Meta Llama):
-
Dedicated/Provisioned Throughput: If you have purchased provisioned throughput for a model, use the provisioned model ARN as the model name.
- Example:
arn:aws:bedrock:<region>:<account-id>:provisioned-model/<model-name>
- Example:
Recommended: While bare model IDs (e.g.,
meta.llama3-8b-instruct-v1:0) work for on-demand inference within the same region, using inference profile IDs is recommended for cross-region routing and better availability. Some newer models may require inference profiles.
Add it in NudgeBee (UI)
In Admin → Integrations → LLM → Add LLM Provider, choose bedrock and enter the LLM Model Name (model or inference profile ID), Region, and the AWS Access Key and AWS Secret Key — the form requires access keys. To use an IAM role (IRSA) instead, configure Bedrock with environment variables as below. See Add an LLM Provider.
Integrating with LLM Server
-
Configure Bedrock in LLM Server:
Add the following configuration to your LLM Server settings:
LLM_PROVIDER=bedrock
LLM_PROVIDER_REGION=<AWS_Region> # e.g., us-west-2
LLM_MODEL_NAME=<Inference_Profile_ID_or_Provisioned_ARN> # e.g., us.meta.llama3-8b-instruct-v1:0
Integrating with RAG Server
-
Configure Bedrock in RAG Server:
Add the following configuration to your RAG Server settings:
EMBEDDINGS_PROVIDER=bedrock
EMBEDDINGS_PROVIDER_REGION=<AWS_Region> # e.g., us-west-2
EMBEDDINGS_MODEL_NAME=<Inference_Profile_ID_or_Provisioned_ARN> # e.g., us.amazon.titan-embed-text-v2:0
To deploy NudgeBee AI models on AWS Bedrock and integrate NudgeBee Model Deployment
Troubleshooting Amazon Bedrock Integration
1. AccessDeniedException When Invoking a Model
Check the exact error and the IAM identity, model or inference-profile ID, and region configured in NudgeBee. Access denial can result from IAM or organization policies as well as model onboarding requirements.
AWS now enables serverless foundation model access automatically when the required permissions are present. For applicable third-party models, first invocation can require AWS Marketplace permissions/subscription setup. Anthropic models also require first-time-use information. Follow AWS model access documentation for the selected model instead of relying on the former manual Modify model access workflow.
2. ValidationException: Invocation requires inference profile
- Symptom: Error when invoking cross-region models (e.g. Anthropic Claude 3.5 Sonnet).
- Remediation:
Use the regional cross-region inference profile ID prefix (e.g.
us.anthropic.claude-3-5-sonnet-20241022-v2:0) instead of bare model names.
3. ThrottlingException: Rate exceeded
- Symptom: API calls fail with
ThrottlingException: Rate exceeded for Bedrock InvokeModel. - Remediation:
Request a Service Quotas increase for
InvokeModel requests per minutein your AWS Bedrock region.