Connecting Dify to Amazon Bedrock: Models, IAM and Region Choices

Connecting a Dify workflow to Amazon Bedrock models

Written by

in

If you self-host Dify on AWS, Amazon Bedrock is the model provider you will probably reach for first. Your applications stay inside your AWS account, access is governed by IAM rather than by an API key from another vendor, and the usage lands on the same AWS bill as the infrastructure. For client work in Japan there is a second reason: region and data-residency choices are yours to make, not a provider’s.

The connection is not one switch, though. It is four separate things that each live in a different place: model access in the Bedrock console, a plugin inside Dify, credentials that join the two, and a region decision underneath all of it. This guide walks through them in the order that avoids the common failures. It assumes Dify is already running — if it is not, the architecture I start from is the ECS Fargate setup in this series.

What you are actually installing

The Bedrock plugin slotting into Dify

The connection is a plugin: the official Amazon Bedrock plugin (published by langgenius, Dify’s own developer) from the Dify Marketplace. You are not forking Dify or running a translation proxy — the plugin registers Bedrock as a model provider inside Dify, and your applications call it like any other provider.

One provider covers three model types: large language models for chat and completion, text-embedding models for knowledge-base indexing, and rerank models for retrieval quality. That breadth is why the setup deserves care. The same configuration will serve your chat applications, decide how every document you index is embedded, and optionally re-order search results — a mistake here is not confined to one app.

Step 1: Enable model access in the Bedrock console

Enabling model access in the Bedrock console

Bedrock models are not switched on by default. In the AWS console, open Amazon Bedrock, go to the model access page, and request access to the models you intend to use. Access is granted per model and per region, so this step comes after you have picked a region (see the region section below) — enabling a model in the wrong region is the single most common reason the later steps appear to fail.

Model availability varies by region. The catalogue in one region is not the catalogue in another, and the gap is not limited to obscure models: a current chat model may be offered in one region and absent from the next. Decide which models you need first, confirm each one is available in your chosen region, and only then build workflows around them.

Step 2: Install the plugin in Dify

Installing the Bedrock plugin from the Marketplace

In Dify, open the Marketplace, find the Amazon Bedrock plugin by langgenius, and install it. Then go to Settings → Model Provider, select Amazon Bedrock, and open its setup form. That form is where the remaining steps land: it takes a region and a set of credentials, and once it validates, the models you enabled in Step 1 become selectable in your applications.

Install the plugin before you troubleshoot missing models. A model that is enabled in the console but never appears in Dify is usually a plugin or credentials problem, while a model that appears but errors on use is usually an access or region problem. Keeping that distinction in mind halves the debugging time later.

Step 3: Credentials — access key or IAM role

Two credential paths: access key or IAM role

The plugin supports two authentication paths. The first is the familiar one: an AWS access key and secret key, with an optional session token if you are using temporary credentials. The second is IAM role authentication, where the plugin obtains credentials from the environment Dify runs in and refreshes them on every invocation, so nothing long-lived is stored at all.

The access key path works anywhere — a laptop trial, a single EC2 instance — and that convenience is its whole case. Its cost is a long-lived secret sitting in Dify’s configuration, which you then have to protect, rotate and eventually revoke. Treat it as a starting point for evaluation, not as the production answer.

On ECS Fargate, prefer the IAM role. Give the Dify services a task role with permission to use Bedrock, and the plugin picks those credentials up automatically — there are no keys in Dify to leak, rotate or forget. This is how the Terraform architecture in this series is wired: the task role is the credential. Whichever path you choose, use separate identities for development and production, so a key or role used in a sandbox cannot reach client data.

Step 4: Assign models to chat, embedding and rerank

Assigning models to chat, embedding and rerank

With the provider saved, assign a default model for each role your workspace uses. The chat model is the visible choice — it is what your applications think with — and several model families are available on Bedrock, each with different strengths, context sizes and prices. Pick per application where it matters rather than forcing one model on everything.

The embedding model deserves more deliberation than it usually gets. Every document in every knowledge base is embedded with the model you choose here, and changing the embedding model later means re-indexing those knowledge bases to match. Choose it deliberately at the start, and treat a later change as a small migration project, not a settings tweak. Rerank is the optional third role: a rerank model re-orders retrieved passages before they reach the chat model, and it is a cheap quality win for knowledge-base applications once the basics work.

Step 5: Make a test call before you build anything

Making a test call to validate the connection

Before building a real application, run the smallest possible test: a one-prompt chat application using your new provider, or the test facility in the model provider settings if your version offers one. A successful call validates model access, credentials and region in a single stroke. A failure at this stage is cheap; the same failure discovered after you have built a workflow is not.

Follow it with a second, smaller test that people skip: create a test knowledge base, upload one short document, and confirm indexing completes. That exercises the embedding path end to end — Dify, the plugin, Bedrock and your vector store — and indexing failures otherwise surface days later, in front of users.

Choosing a region, and cross-region inference

Region choice and cross-region inference, Japan highlighted

Your Bedrock region does not have to be the region Dify runs in, but it usually should be: every prompt crosses between them, and distance adds latency to every call. The stronger forces are availability and residency. As noted above, the model catalogue differs by region, so the region decision and the model decision are really one decision — make them together, and write the outcome down, because changing region later changes the model identifiers your applications reference.

Bedrock also offers cross-region inference profiles, which route a request across several regions behind one identifier to improve throughput and availability. For Japanese client work the important variant is the Japan inference profile, which keeps routing within Japan. If a client’s data may not leave the country, that profile is how you use Bedrock’s managed routing without giving up residency — confirm the profile covers the models you enabled before you rely on it.

Least-privilege IAM, in practice

Least-privilege IAM: only the keys you need

Whichever identity you use — IAM user for keys, task role on Fargate — it needs permission to invoke the models you enabled, in the regions you use, and nothing else. It does not need administrator access, it does not need other AWS services, and it does not need models you have not enabled. Scope the policy to those models, and widen it deliberately, one model at a time, as you enable more.

Two habits make this sustainable. First, keep development and production identities separate, so experiments never hold production permissions. Second, review the policy whenever you enable a new model or region; permission drift in both directions — too broad, and silently stale — tends to accumulate exactly at those moments.

What it costs

Pay-per-token cost of Bedrock models

Bedrock is pay-per-token: you pay for input and output tokens on language models, and for input tokens on embedding, with no hourly charge for the connection itself and no fee for the Dify plugin. The practical consequence is the one noted in the flagship architecture guide: for a busy team, model usage will exceed the infrastructure bill. The Dify platform might cost the price of a team lunch per month; the models it calls are the real spend.

Budget accordingly. Put a billing alarm on the AWS account, watch usage per application once you have real traffic, and remember that embedding a large knowledge base is a one-off token cost that can surprise you if you index first and count later.

Troubleshooting

Troubleshooting the Bedrock connection

The model does not appear in Dify. Check, in order: the plugin is installed; the credentials validate; and model access is enabled for that model in the region configured in the provider. Most cases are the third one, in a different region than the one you checked.

Access denied when the model is called. The identity lacks permission to invoke that model, or access is still pending. Compare the model and region in the error against the console’s model access page, then against your IAM policy’s scope.

A model is enabled but invocation asks for an inference profile. Some models can only be invoked through a cross-region inference profile rather than by their bare model ID. Select the profile — for Japan-residency requirements, the Japan profile — in place of the direct model where the plugin offers the choice.

It works in the Bedrock playground but not in Dify. The playground uses your console identity; Dify uses the credentials or role you configured. The two are different identities, possibly in different accounts — check the Dify-side identity first.

Summary

Bedrock connected and glowing steadily

Connect in this order and the pieces stay separable: choose a region, enable model access there, install the official plugin, authenticate with an IAM role wherever Dify runs on AWS (task role on Fargate, keys only for trials), assign chat, embedding and rerank models deliberately, and test both a chat call and a document index before building anything real. Do that, and Bedrock becomes the least interesting part of your Dify stack — which is exactly what infrastructure should be.

If your Dify is not on AWS yet, start with Self-Host Dify on AWS with Terraform. A companion checklist for upgrading Dify in production is in preparation.