Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Tools · Function

createAmazonBedrock

Creates a customized Amazon Bedrock provider for the AI SDK. Configure AWS settings such as the region and credential provider, then use the returned provider to select Bedrock models.

How it works

createAmazonBedrock constructs a customized provider instance for Amazon Bedrock. Configure it with a region and AWS credential settings or a credential provider, then call the resulting provider with a model identifier to obtain a language model.

Syntax

createAmazonBedrock(options)

Parameters

NameTypeDescription
optionsCreateAmazonBedrockOptionsConfiguration object containing Amazon Bedrock provider settings, including region and AWS credential options.

Returns

A customized Amazon Bedrock provider instance that can be called with a model identifier.

Key points

  • The factory belongs to the AI SDK's Amazon Bedrock integration and gives applications access to Bedrock language models.
  • For default behavior, use the exported bedrock instance instead of calling the factory.
  • The factory is called with an options object and returns a provider variable that can be used to select models.
  • A region is one of the documented settings used when constructing a customized provider.

Common mistakes

  • Use the factory when you need custom configuration; the package also exposes a default provider instance for standard setups.
  • Install and import the provider from @ai-sdk/amazon-bedrock rather than the core ai package.

Example: Create a customized Bedrock provider

import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';

const bedrock = createAmazonBedrock({
  region: 'us-east-1',
  credentialProvider: fromNodeProviderChain(),
});

const model = bedrock('anthropic.claude-3-5-sonnet-20240620-v1:0');

Creates a customized Amazon Bedrock provider using an AWS region and credential provider, then uses it to select a model.

When to use it

Regional model access

An application must explicitly choose its AWS region for Bedrock requests.

Managed AWS authentication

A server uses the AWS SDK's standard runtime credential resolution.

Custom provider instances

Different application components require separate Bedrock configurations.

Interview questions

QWhat is createAmazonBedrock used for?

createAmazonBedrock is the factory for a customized Amazon Bedrock provider. The returned provider can be configured with settings such as an AWS region and credential provider, then called with a model identifier.

Follow-up: How would you avoid hard-coding credentials? Use the AWS SDK credential provider chain and pass it through credentialProvider, allowing the runtime to resolve credentials from its configured sources.

QHow do you configure a Bedrock provider with AWS credentials?

Import createAmazonBedrock from @ai-sdk/amazon-bedrock and call it with provider settings. A typical configuration supplies region: 'us-east-1' and credentialProvider: fromNodeProviderChain().

Follow-up: What alternative exists for an uncustomized setup? Import the package's default bedrock provider instance instead of creating a new one.

QWhat does the returned provider do?

The factory returns a provider instance that is then invoked with a Bedrock model identifier. That model handle can be supplied to AI SDK generation APIs.

Follow-up: Why might a team create multiple instances? Separate instances can represent different regions or credential configurations while retaining the same provider interface.

  • bedrock
  • createBedrockAnthropic
  • @ai-sdk/amazon-bedrock
  • fromNodeProviderChain

Source: Amazon Bedrock. Checked 2026-10-15.