LiteLLM with Amazon Bedrock

A planning and build guide for routing Bedrock models through a self-hosted LiteLLM gateway with the right credentials, routes, cost settings and controls.

On this page

How LiteLLM with Amazon Bedrock works for teams that run their own gateway

If you want Bedrock models behind a gateway that issues virtual keys, enforces budgets and writes logs, the LiteLLM proxy is the layer that does that work, and Bedrock is the layer that serves the model. LiteLLM calls Bedrock through boto3, the AWS SDK for Python, and accepts requests in the OpenAI request format, so your applications keep one client interface while the gateway translates each call to the Bedrock API. The gateway holds the keys, decides which team or application may call which model, counts tokens against budgets and records each request. Bedrock supplies the models, bills for inference, and enforces the permissions attached to the AWS identity the gateway uses. The integration runs entirely inside your AWS account, under your IAM policies, your VPC design and your CloudTrail configuration, so the gateway is one more workload you control rather than a service that sits outside your environment.

The first decision is how the gateway authenticates to AWS. LiteLLM supports every boto3 credential option, so the standard credential chain applies, including an IAM role attached to the workload's compute, which is the option most teams should prefer for a production gateway because no long-lived secret has to be stored. The AWS_BEARER_TOKEN_BEDROCK API key is an alternative for teams that cannot use an IAM role, and it carries its own rotation and storage obligations. Route choice is the second decision. LiteLLM offers converse, invoke and chat_completions route variants for Bedrock, and the right one depends on which models you call and which request features your applications need, so confirm model support for each route against the LiteLLM Amazon Bedrock documentation before you standardize on one. Settle both choices, along with the region and the IAM policy scope, before any team receives a virtual key.

Plan for the points where the gateway and Bedrock each own part of the behavior. Quota, model access and region availability are controlled on the AWS side, and a request that Bedrock rejects will surface through the gateway as an error your runbooks must handle. Cross-region inference, guardrails and Bedrock-native APIs add further settings that change which account and region receive the data, so each one needs an owner and a documented check. Ask your AWS account team and your security team to confirm which Bedrock features and regions your organization may use, and test the chosen routes with a non-production key and a dedicated IAM role before you rely on them for budgets or audit records.

What you need before connecting Bedrock to LiteLLM

Connecting Bedrock to a self-hosted gateway touches four layers: the AWS account and model access, the LiteLLM data stores, the LiteLLM release line, and the network path. Work through these before writing any Bedrock route into the proxy configuration, so that a failure can be traced to one layer.

AWS account and Bedrock model access

Model access in Bedrock is enabled per account and per region, and the models you can call depend on that setup. Confirm in your own AWS account which foundation models are enabled and which regional endpoints you can reach, because availability differs by model and region. Decide which IAM principal the gateway will assume, and scope its permissions to the specific models it needs. Model availability is an account-level check, not something this guide can confirm for you.

LiteLLM Bedrock docs

PostgreSQL for virtual keys

Virtual keys, per-key and per-team budgets, and spend tracking all require a PostgreSQL database. Without it, you can route Bedrock calls through the proxy, but you cannot issue keys that carry budgets or limits for Bedrock models. Plan the database as a managed or self-run instance in the same network zone as the gateway, and confirm backup and restore procedures before go-live.

Virtual keys docs

Redis 7.0 or newer

Redis becomes required once more than one proxy instance runs, because it holds shared rate limits, router state and cache. Run a single instance for a pilot, but plan Redis from the start if you expect horizontal scaling. Confirm that the Redis version you deploy is 7.0 or newer, and that the gateway can reach it on every replica.

LiteLLM release line

LiteLLM supports the four most recent stable minor versions for both open source and Enterprise deployments. Pin the image to a version on that line, record it in your configuration as code, and check the releases page before each upgrade. Bedrock route names and boto3 behavior can change between minors, so test your Bedrock configuration against the exact version you intend to run.

LiteLLM releases

Network path to Bedrock endpoints

The gateway must reach the regional Bedrock runtime endpoints over a path your network team has approved, such as an outbound route through a proxy, a NAT gateway, or a private endpoint if you use one. Check egress rules from the gateway's subnet, DNS resolution for the regional hostnames, and any TLS inspection that could break the connection. Test the path from the gateway host itself, not from a workstation.

Credentials and secret storage

Decide between an IAM role attached to the workload, the standard boto3 credential chain, or the AWS_BEARER_TOKEN_BEDROCK API key. Each has different rotation and audit properties. Store the master key and any static credentials in a secret manager rather than in plain configuration, and confirm who can read them. The choice affects how you answer access reviews later.

Configuration sequence for the Bedrock connection

This sequence takes a self-hosted LiteLLM gateway from no AWS access to governed Bedrock calls, with each step closed by a check so the team knows the connection works before keys and budgets depend on it. It is written for the platform engineers and cloud team who will build and operate the connection.

  1. Create the identity the gateway uses

    The cloud or platform team creates an IAM role for the gateway workload, such as an IAM role attached to the pod or instance that runs the proxy, scoped to the Bedrock model invocation actions for the models you approve. Keep the policy limited to named foundation models or inference profiles rather than broad access, and confirm the exact action names and resource formats against the current AWS Bedrock documentation for your account. The step is done when the identity can be assumed by the gateway workload and the policy has been reviewed by the security owner.

  2. Choose the credential method

    The team decides between the boto3 default credential chain and the Bedrock API key option. LiteLLM uses boto3 for Bedrock authentication and supports all boto3 credential options, so the IAM role route fits workloads running in AWS, while the AWS_BEARER_TOKEN_BEDROCK API key option needs a secret manager entry and its own rotation process. Record the choice and the owner of each secret in your configuration standard. The step closes when the chosen credential source resolves inside the running proxy container, which you can confirm from the proxy startup logs without printing the secret value.

  3. Add Bedrock models with the correct routes

    The platform engineer adds each approved Bedrock model to the proxy configuration file under a model name that callers use, and sets the provider route for each entry. LiteLLM's Bedrock routes include converse, invoke and chat_completions variants, so select the route that matches the API your callers need and check the provider documentation for model-specific support. Keep the configuration in version control so changes are reviewed. The step closes when the proxy starts cleanly and lists the new model names in its model endpoint.

  4. Set the AWS region

    The engineer sets the AWS region for each Bedrock model entry, matching the region where the model is enabled for the account. Cross-region use changes which region serves the request and what data residency applies, so record that decision with the compliance owner before enabling it. Confirm that model access has been granted in the chosen region in the AWS console. The step closes when a model entry resolves to the expected region in the proxy configuration and a test call returns a response from that region.

  5. Verify a test call for each route

    The engineer sends one test request per configured route through the gateway, using a master or admin key in a non-production environment. A Converse route test should return a completion, and an Invoke test should return a response in the expected format for that model family. Repeat for each route you enabled, and capture the request ID. The step is complete when every route returns a successful response and the request appears in the proxy's request logs, which confirms the gateway, the IAM identity and the Bedrock model are working together.

  6. Confirm spend is logged for Bedrock calls

    The engineer checks that the successful test calls created spend records in the gateway database, matched to the Bedrock model name. Compare the recorded model and token counts with the figures in the Bedrock response so you know the cost data reflects what the provider bills. If a model shows no cost, do not proceed until the pricing mapping is fixed, because budgets depend on it. The step closes when each test model has a spend entry with a non-zero cost or a documented reason for zero cost.

  7. Restrict virtual keys to Bedrock model names

    The administrator creates virtual keys for teams or services and restricts each key to the specific Bedrock model names it needs. Virtual keys require a PostgreSQL database, and they can limit access to named models, so callers cannot reach models they were not approved to use. Test one key against an allowed model and one against a blocked model, expecting the blocked call to be rejected. The step closes when both results match the policy.

  8. Set budgets and rate limits on keys

    The administrator sets budgets at the key, user or team level and adds TPM and RPM limits where needed, then confirms that a small budget test stops further calls once the limit is reached. Virtual keys support per-key, per-user and per-team budgets, and temporary budget increases can be granted when there is a documented need. Record who may approve increases and where the approval is kept. The step closes when a deliberate budget test is blocked at the limit and the spend history shows the calls that counted toward it.

IAM role, credential chain or Bedrock API key: which fits your gateway

When the LiteLLM proxy runs on AWS, the preferred pattern is to attach an IAM role to the compute that hosts it, such as an EC2 instance profile, an ECS task role or an EKS pod identity. boto3 resolves credentials from the role automatically through its default credential chain, so no long-lived access key needs to be stored in the proxy configuration or in environment variables. Credentials are short-lived and rotate without operator action, and CloudTrail records calls under the role session, which makes the gateway's activity traceable to a specific workload.

  • No stored keys: nothing secret sits in config.yaml or the container image for Bedrock access.
  • Automatic rotation: AWS issues and renews temporary credentials for the role.
  • Scoped permissions: the role's policy can name specific model ARNs and regions, which limits what a compromised proxy can invoke.
  • Clear audit trail: calls appear under the role identity, so separate gateways or environments should use separate roles.
  • Blast radius is the role: any workload that can assume the role inherits its Bedrock permissions, so restrict trust policies tightly.

Confirm which credential sources your LiteLLM version resolves and whether your chosen compute platform supports the role mechanism you plan to use. Check the current option set in the LiteLLM Bedrock documentation at LiteLLM docs: Amazon Bedrock.

How a request travels from an application through LiteLLM to Bedrock

The request starts at a calling application that presents a LiteLLM virtual key inside the client network. The LiteLLM proxy checks that key against its budget and model permissions, then hands the call to the router, which applies retries and fallback. The boto3 credential chain resolves an IAM role before the call crosses the trust boundary to the Bedrock runtime endpoint. Spend records and logs are written to PostgreSQL on the side, so reviewers can confirm both who was charged and which credential made the call.

Request path from a calling application through LiteLLM to Bedrock, with the trust boundary to AWS.

Choosing Converse, Invoke and cross-region routes

Choose the route before you choose the region. The Converse route suits most new chat and tool-use workloads because it gives one request shape across Bedrock models, so your gateway configuration and caller behavior stay consistent when you add or swap a model. The Invoke route sends the model's native request body, which you need when a model feature or parameter is only exposed through its native API. The chat_completions variant lets callers keep the OpenAI request format while LiteLLM handles the Bedrock call. Confirm which route each model you plan to expose supports, and which features (streaming, tool calls, embeddings, images) work on each, against the Bedrock section of the LiteLLM docs and the current Bedrock model documentation for your account.

Model IDs and inference profiles decide whether a cross-region call happens at all. A foundation model ID called in a region where the model is not hosted fails, while a cross-region inference profile ID routes requests across a set of regions that AWS defines for that profile. Confirm, for each model, whether you call the base model ID or a profile ID, which regions the profile can use, and whether your IAM policy grants invoke permission on both the profile and the underlying foundation model resources. Test the exact model string in the model field of your LiteLLM config, because a mismatch between the route prefix and the ID is a common cause of routing errors.

Region choice sets data residency and latency together. A cross-region profile can send prompts and completions to any region in its set, so a profile that spans regions outside your approved jurisdictions may conflict with your data handling commitments even when the caller's region is compliant. Latency follows the same path: a region far from your gateway and application adds round-trip time to every request, and failover to another region adds more. Ask your compliance team which regions are approved, then pin your routes and profiles to that set, and record the decision alongside your logging and retention settings so reviewers can trace where prompts were processed.

Mapping Bedrock models, IAM permissions and LiteLLM keys

This table lists the attributes to record for each Bedrock model LiteLLM exposes, so every model name traces to an IAM grant, a virtual key scope and an owner for spend. Use one row per model or inference profile, and confirm each value in your own AWS account and LiteLLM config before the key is issued.

AttributeWhat to recordWhy it matters
LiteLLM model nameThe alias callers send, such as a model_name entry in the proxy config, mapped to one Bedrock routeCallers depend on this alias, so changing the target later affects every key scoped to it
Bedrock model or inference profile IDThe exact foundation model ID or inference profile ID, plus the AWS region it resolves inA cross-region inference profile can route to several regions, so the IAM and data-residency review must cover each one
Bedrock routeConverse, invoke or the chat completions variant configured for that model aliasThe route determines which Bedrock API actions the role must be allowed to call
IAM actions grantedThe Bedrock invoke actions the role allows on the specific model or profile ARN, confirmed against the current AWS documentationScoping to named resources rather than all models keeps a leaked credential from reaching unapproved models
Credential sourceThe boto3 credential chain entry used (IAM role, environment, profile) or the Bedrock API key option, with its rotation ownerEach credential type has a different rotation and revocation path that the team must be able to run
Virtual key scopeThe LiteLLM key or team allowed to call this model alias, and any model restriction on the keyRestricting keys to named models limits what a single caller can reach through the gateway
Budget and rate limitsThe owning team, budget and TPM or RPM limits attached to the key or team for this modelSpend is only attributable if every model alias has a named owner and a budget set on the key
Guardrail attachmentWhether a Bedrock guardrail is applied to this route, with its identifier and versionGuardrail coverage varies by route, so the record shows which traffic was screened

Securing the Bedrock path through the gateway

The gateway is the single point where your applications reach Bedrock, so it holds the AWS identity, the master key and the admin surface. The cards below cover the controls that keep that path narrow, and each one should be confirmed against your own AWS accounts, network design and identity setup before go-live.

Scope IAM to named models

Give the identity LiteLLM uses to call Bedrock permission only for the model IDs and inference profiles your routes actually reference, rather than a wildcard over all Bedrock models. Review the model_list in your configuration against the IAM policy, since a route added later can silently reach a model the policy never intended. Ask your AWS team to confirm which Bedrock actions the policy grants, including any used for cross-region calls, and to test that a denied model fails at the gateway.

Bedrock provider docs

Prefer roles over static AWS keys

Where the gateway runs on AWS compute, attach an IAM role so boto3 picks up temporary credentials from the standard credential chain. If you must use static access keys or the AWS_BEARER_TOKEN_BEDROCK API key, store them in a secret manager and rotate them on a schedule your security team sets. Confirm which credential source the running pods or hosts actually resolve, because an environment variable can override a role without anyone noticing.

Keep the master key out of config files

The LITELLM_MASTER_KEY must start with sk- and controls administrative access to the proxy, so it should live in a secret manager and be injected at runtime, not written into config.yaml or a container image. Any static AWS secret the gateway uses belongs in the same store. Ask who can read those secrets, how access is logged, and how a leaked key would be rotated without taking every team's virtual keys offline.

Production best practices

Restrict admin and network exposure

Only the callers that need Bedrock access should reach the proxy, and only administrators should reach the admin UI and key management endpoints. Place the gateway behind an internal load balancer or private ingress, restrict egress from the gateway to the Bedrock endpoints in your chosen regions through VPC endpoints or firewall rules, and test that the admin paths are unreachable from general user networks. Confirm these rules in your own environment, since the exact network layout depends on your cluster and account design.

Apply Bedrock guardrails through LiteLLM

Where policy requires content screening, attach a Bedrock guardrail to the routes that serve sensitive teams so the check runs on every call through the gateway, not only in application code. Decide which guardrail version each route uses, who approves changes to it, and what the gateway returns when a guardrail blocks a request. Confirm with your security team that the guardrail is applied to both prompts and responses, and check how team-level guardrails are configured in your edition.

Enterprise controls for AWS secrets

Open-source LiteLLM covers the core settings above, but the Enterprise edition adds secret manager integrations for AWS, along with audit logs, team-level guardrails and IP allowlisting. Ask the LiteLLM team which of these your deployment needs, confirm the exact Enterprise features in the current documentation, and verify them during your own review. Budget for this decision as part of the licensing discussion, and record which controls you rely on so the upgrade path stays clear.

Enterprise docs

Bedrock guardrails and pass-through for Bedrock-native APIs

Bedrock guardrails are configured in AWS and then referenced from the LiteLLM call, so the gateway does not enforce them on its own. Decide which guardrail, which version and which region apply to each team or model group before you write the route. Confirm in the LiteLLM Bedrock documentation how the guardrail identifier and version are passed in the request or model configuration for the route you use, and confirm that the IAM role or credential chain used by the proxy has permission to invoke the guardrail. Test a prompt that the guardrail should block and a prompt it should allow, and check that the blocked response reaches the caller in the format your application expects. Keep the guardrail ID and version in configuration you manage as code, so a change in AWS is visible and reviewed.

Pass-through is needed when the caller must use a Bedrock-native API that the OpenAI request format does not cover, such as Bedrock-specific operations, features that have no OpenAI-compatible equivalent, or existing SDK code that already calls Bedrock directly. Treat it as a separate path with its own risks. Requests that go through pass-through may not carry the same per-key logging, budget accounting, rate limits or model restrictions that apply to requests sent through the standard OpenAI-format routes, so confirm which of those controls apply to each path in your version before you approve it. Route only the workloads that need native features through pass-through, and document why. For every path, test the guardrail behavior, the spend record in the gateway, and the log entry a security reviewer would need, then repeat those checks after each LiteLLM upgrade.

Common Bedrock failures behind LiteLLM and how to fix them

This table lists the failures teams most often hit when LiteLLM calls Amazon Bedrock, with the likely cause and the first check for each. Read it as a triage order: confirm the symptom in the proxy logs, then work through the cause column before changing IAM policies or routes. The main takeaway is that most Bedrock errors behind a gateway come from identity, region or route mismatches, not from LiteLLM itself.

SymptomLikely causeFirst check
AccessDenied or 403 from BedrockThe IAM role or user behind the boto3 credential chain lacks an action such as bedrock:InvokeModel or bedrock:Converse on the model or inference profile ARNRun the call with the same credentials outside LiteLLM and read the denied action name in the error message
Model not found or ValidationException on a model IDWrong region for the model, or model access is not enabled for the account in that regionConfirm the model ID, the region in the route config and that model access is granted in the Bedrock console for that region
Calls work locally but fail in the clusterThe credential chain picks up a different profile, environment variable or instance role than the one you tested withCompare AWS_PROFILE, AWS_ACCESS_KEY_ID and the pod's service account identity with the identity you expect
Wrong response shape or unsupported parameterRoute mismatch: a model called through invoke when the converse route fits its request format, or the reverseCheck the route prefix in the model config and confirm it matches the Bedrock route variant documented for that model
429 or throttling errors that appear only under loadSeveral proxy replicas each enforce limits locally, with no shared Redis state for rate limits and router cooldownsConfirm Redis 7.0 or newer is configured for all replicas and that every replica reads the same router and limit state
Spend missing or lower than the Bedrock billRequests routed through a non-logging path, a model name that lacks cost mapping, or spend updates not yet flushed to the databaseCompare request IDs in the Bedrock invocation records with LiteLLM spend logs, then check the cost mapping for the model ID used
Cross-region calls fail or are blocked by policyThe inference profile or cross-region setting uses regions the IAM policy or data residency rules do not allowReview the region list of the inference profile against the policy conditions and your approved regions

Questions teams ask before connecting Bedrock to LiteLLM

What does it cost to connect Bedrock to a self-hosted LiteLLM gateway?

The cost comes from several separate components, and only some of them are paid to a vendor. Bedrock charges your AWS account for model usage, so that spend follows your traffic and the models you enable. The gateway, PostgreSQL and Redis run in your infrastructure, so you pay for their compute, storage and backups. Team time covers planning, configuration, testing and handover, and it is usually the largest one-time cost. LiteLLM itself is MIT licensed for the core, so the software line item depends on whether you add Enterprise features. Ask any partner for a quote that splits these components so you can see which ones recur.

Which costs are one-time and which recur after go-live?

One-time costs include scoping, IAM role design, model access requests, network changes, configuration, testing and documentation. Recurring costs include Bedrock consumption, hosting for the gateway and its database and Redis, backups, log storage, patching and upgrades, and any support retainer. Model usage is the most variable recurring cost because it follows how many people and applications call the gateway. A written quote should state which items are fixed, which are estimates, and which depend on your usage volumes.

What drives the effort of a Bedrock connection up or down?

Effort rises with the number of AWS accounts and regions involved, the number of models you need approved, and how strictly your organization controls outbound network paths. Credential design matters too: an IAM role on EKS or EC2 is simpler to govern than long-lived keys, and per-team keys on the gateway add configuration work. Cross-region inference, Bedrock guardrails and pass-through routes each add testing. Effort falls when the AWS account structure, model list and identity provider are already settled before work begins.

How long does a Bedrock connection usually take to set up?

Duration depends mostly on approvals and access, not on the LiteLLM configuration itself. The technical steps (credentials, a model route per approved model, a test key and a budget) are usually short once access exists, while model access requests, IAM review, security sign-off and network changes often set the schedule. Ask any partner to show the sequence and which steps depend on your internal teams, and treat any duration without a stated set of assumptions as a guess.

What does the work need from our AWS account and network team?

The work needs access to the AWS account or accounts where Bedrock will be called, permission to create or review IAM roles and policies, and a decision on which models and regions are approved. Network teams need to confirm that the gateway can reach the Bedrock endpoints in the chosen regions, and that any proxy, egress or private endpoint rules allow the traffic. Security teams should approve the credential method, the logging destination and who can change model routes. Gather these items before scoping so the quote reflects real dependencies.

Can our internal platform team connect Bedrock to LiteLLM alone?

A team that already runs Kubernetes or container platforms, manages AWS IAM and operates PostgreSQL and Redis can usually do the core connection itself, using the LiteLLM Bedrock documentation as a reference. The harder parts are usually the ones that touch governance: designing model approvals, separating keys by team, testing guardrails and producing evidence for a security review. If those skills or hours are missing, a fixed-scope engagement can cover the build and handover while your team keeps ownership.

What should we ask for in a written quote for this work?

Ask for a scope listing each AWS account, region, model family and route in scope, along with the credential method and the Bedrock-native APIs you need. Request a list of deliverables, such as configuration as code, test results, runbooks and a handover session. Ask which items the quote excludes, including Bedrock usage, gateway hosting, database and Redis sizing, and any retesting. Confirm the acceptance criteria, the timeline assumptions, what you must provide and how changes to scope are priced. DeployOpen agrees scope, deliverables and timelines in writing before work starts.

What happens to costs if Bedrock usage grows after launch?

Bedrock charges will grow with token volume, so the gateway's budgets, rate limits and per-key spend tracking become the main controls for keeping usage predictable. Those settings are configured during setup, and they add some work to design and test. Ask any partner how budgets will be tied to teams and models, and how spend data will be checked against your AWS bills, since the gateway's numbers and provider invoices can differ.

How DeployOpen scopes and delivers a LiteLLM Bedrock integration

DeployOpen agrees the scope in writing before any work starts. For a Bedrock integration, the written scope names the AWS accounts and regions in use, the identity model (IAM roles for workloads on AWS, or a bearer token where that is the approved option), the Bedrock models and routes to expose, the virtual keys and team budgets that will sit on top, and the logging destination. Deliverables and timelines are fixed in the same document, so the client knows what is built, what is verified and what is handed over. DeployOpen does not publish a price list. A quote follows from the written scope, and the scope items that move cost most are the number of accounts, the number of teams and keys, whether cross-region inference is in use, and whether Bedrock guardrails are wired into the gateway.

The work runs inside the client's own AWS account or infrastructure. DeployOpen deploys the LiteLLM proxy, its PostgreSQL database and Redis (needed once more than one proxy instance runs) in the environment the client controls, and configures the Bedrock credentials through the boto3 chain so no long-lived keys are copied into configuration files. Verification covers each Bedrock route the client approved, each virtual key's model restrictions, budget and rate limits, and a check that spend and request logs appear where the client expects them. The client receives handover documentation covering the configuration as code, the IAM policies, the key and budget register, the runbook for rotating credentials, and the test evidence. Confirm with your own security team which account owns the role trust policies and who approves changes to them before the scope is signed.

Ongoing support is optional and sold as a retainer. Upgrades to new LiteLLM releases, changes to Bedrock model access, and repeated security testing of the gateway are separate from the initial build and can be covered by a retainer agreed in writing. Ask any partner, including DeployOpen, to state which of these items the quote includes, how often testing is repeated, and who is responsible for patching the proxy image. Plan the retainer question early, because the LiteLLM project supports only its four most recent stable minor versions, so a gateway that is not upgraded will eventually fall outside that window.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.