MCPcopy Index your code
hub / github.com/aws-samples/bedrock-chat

github.com/aws-samples/bedrock-chat @v3.17.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.17.0 ↗ · + Follow
1,539 symbols 5,983 edges 362 files 333 documented · 22%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Bedrock Chat (BrChat)

English | 日本語 | 한국어 | 中文 | Français | Deutsch | Español | Italian | Norsk | ไทย | Bahasa Indonesia | Bahasa Melayu | Tiếng Việt | Polski | Português Brasil

A multilingual generative AI platform powered by Amazon Bedrock. Supports chat, custom bots with knowledge (RAG), bot sharing via a bot store, and task automation using agents.

[!Warning]

V3 released. To update, please carefully review the migration guide. Without any care, BOTS FROM V2 WILL BECOME UNUSABLE.

Bot Personalization / Bot store

Add your own instruction and knowledge (a.k.a RAG. The bot can be shared among application users via bot store market place. The customized bot also can be published as stand-alone API (See the detail).

Screenshots

You can also import existing Amazon Bedrock's KnowledgeBase.

[!Important] For governance reasons, only allowed users are able to create customized bots. To allow the creation of customized bots, the user must be a member of group called CreatingBotAllowed, which can be set up via the management console > Amazon Cognito User pools or aws cli. Note that the user pool id can be referred by accessing CloudFormation > BedrockChatStack > Outputs > AuthUserPoolIdxxxx.

Multi-Tenant Usage of Knowledge Base

In Amazon Bedrock Knowledge Bases, by default, the number of Knowledge Bases that can be created in a single AWS account is limited to 100. To work around this limitation, you can use 'multi-tenant' mode, where a Knowledge Base with common settings is shared among multiple bots, and files uploaded by each bot are filtered by attaching the Bot ID as metadata.

Newly created bots will have multi-tenant mode enabled by default. To migrate existing bots to multi-tenant mode, change the bot's knowledge settings to "Create a tenant in a shared Knowledge Base."

To migrate multiple bots to multi-tenant mode in bulk, execute commands like the following:

aws dynamodb execute-statement --statement "UPDATE \"$BotTableNameV3\" SET BedrockKnowledgeBase.type='shared' SET SyncStatus='QUEUED' WHERE PK='$UserID' AND SK='BOT#$BotID'"
# Execute for all target bots

aws stepfunctions start-execution --state-machine-arn $EmbeddingStateMachineArn

Administrative features

API Management, Mark bots as essential, Analyze usage for bots. detail

Screenshots

)

Agent

By using the Agent functionality, your chatbot can automatically handle more complex tasks. For example, to answer a user's question, the Agent can retrieve necessary information from external tools or break down the task into multiple steps for processing.

Screenshots

🎓Workshop

A comprehensive workshop is available here.

Screenshot

🚀 Super-easy Deployment

  • In the us-east-1 region, open Bedrock Model access > Manage model access > Check all of models you wish to use and then Save changes.

Screenshot

Supported regions

Please make sure that you deploy Bedrock Chat in a region where OpenSearch Serverless and Ingestion APIs are available, if you want to use bots and create knowledge bases (OpenSearch Serverless is the default choice). As of August 2025, the following regions are supported: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-south-2, eu-north-1, sa-east-1

For the bedrock-region parameter you need to choose a region where Bedrock is available.

  • Open CloudShell at the region where you want to deploy
  • Run deployment via following commands. If you want to specify the version to deploy or need to apply security policies, please specify the appropriate parameters from Optional Parameters.
git clone https://github.com/aws-samples/bedrock-chat.git
cd bedrock-chat
chmod +x bin.sh
./bin.sh
  • You will be asked if a new user or using v3. If you are not a continuing user from v0, please enter y.

Optional Parameters

You can specify the following parameters during deployment to enhance security and customization:

  • --disable-self-register: Disable self-registration (default: enabled). If this flag is set, you will need to create all users on cognito and it will not allow users to self register their accounts.
  • --enable-lambda-snapstart: Enable Lambda SnapStart (default: disabled). If this flag is set, improves cold start times for Lambda functions, providing faster response times for better user experience.
  • --ipv4-ranges: Comma-separated list of allowed IPv4 ranges. (default: allow all ipv4 addresses)
  • --ipv6-ranges: Comma-separated list of allowed IPv6 ranges. (default: allow all ipv6 addresses)
  • --disable-ipv6: Disable connections over IPv6. (default: enabled)
  • --allowed-signup-email-domains: Comma-separated list of allowed email domains for sign-up. (default: no domain restriction)
  • --bedrock-region: Define the region where bedrock is available. (default: us-east-1)
  • --repo-url: The custom repo of Bedrock Chat to deploy, if forked or custom source control. (default: https://github.com/aws-samples/bedrock-chat.git)
  • --version: The version of Bedrock Chat to deploy. (default: latest version in development)
  • --cdk-json-override: You can override any CDK context values during deployment using the override JSON block. This allows you to modify the configuration without editing the cdk.json file directly.

Example usage:

./bin.sh --cdk-json-override '{
  "context": {
    "selfSignUpEnabled": false,
    "enableLambdaSnapStart": true,
    "allowedIpV4AddressRanges": ["192.168.1.0/24"],
    "allowedCountries": ["US", "CA"],
    "allowedSignUpEmailDomains": ["example.com"],
    "globalAvailableModels": [
      "claude-v3.7-sonnet",
      "claude-v3.5-sonnet",
      "amazon-nova-pro",
      "amazon-nova-lite",
      "llama3-3-70b-instruct"
    ]
  }
}'

The override JSON must follow the same structure as cdk.json. You can override any context values including:

  • selfSignUpEnabled
  • enableLambdaSnapStart
  • allowedIpV4AddressRanges
  • allowedIpV6AddressRanges
  • allowedCountries
  • allowedSignUpEmailDomains
  • bedrockRegion
  • enableRagReplicas
  • enableBedrockCrossRegionInference
  • globalAvailableModels: accepts a list of model IDs to enable. The default value is an empty list, which enables all models.
  • logoPath: relative path to the logo asset within the frontend public/ directory that appears at the top of the navigation drawer.
  • And other context values defined in cdk.json

[!Note] The override values will be merged with the existing cdk.json configuration during the deployment time in the AWS code build. Values specified in the override will take precedence over the values in cdk.json.

Example command with parameters:

./bin.sh --disable-self-register --ipv4-ranges "192.0.2.0/25,192.0.2.128/25" --ipv6-ranges "2001:db8:1:2::/64,2001:db8:1:3::/64" --allowed-signup-email-domains "example.com,anotherexample.com" --bedrock-region "us-west-2" --version "v1.2.6"
  • After about 35 minutes, you will get the following output, which you can access from your browser
Frontend URL: https://xxxxxxxxx.cloudfront.net

The sign-up screen will appear as shown above, where you can register your email and log in.

[!Important] Without setting the optional parameter, this deployment method allows anyone who knows the URL to sign up. For production use, it is strongly recommended to add IP address restrictions and disable self-signup to mitigate security risks (you can define allowed-signup-email-domains to restrict users so that only email addresses from your company's domain can sign up). Use both ipv4-ranges and ipv6-ranges for IP address restrictions, and disable self-signup by using disable-self-register when executing ./bin.

[!TIP] If the Frontend URL does not appear or Bedrock Chat does not work properly, it may be a problem with the latest version. In this case, please add --version "v3.0.0" to the parameters and try deployment again.

Architecture

It's an architecture built on AWS managed services, eliminating the need for infrastructure management. Utilizing Amazon Bedrock, there's no need to communicate with APIs outside of AWS. This enables deploying scalable, reliable, and secure applications.

Deploy using CDK

Super-easy Deployment uses AWS CodeBuild to perform deployment by CDK internally. This section describes the procedure for deploying directly with CDK.

  • Please have UNIX, Docker and a Node.js runtime environment.

[!Important] If there is insufficient storage space in the local environment during deployment, CDK bootstrapping may result in an error. We recommend expanding the volume size of the instance before deploying.

  • Clone this repository
git clone https://github.com/aws-samples/bedrock-chat
  • Install npm packages
cd bedrock-chat
cd cdk
npm ci
  • If necessary, edit the following entries in [cdk.json](./cdk/cdk.j

Extension points exported contracts — how you extend this code

ImportMetaEnv (Interface)
(no doc)
frontend/src/vite-env.d.ts
ApiPublishmentStackProps (Interface)
(no doc)
cdk/lib/api-publishment-stack.ts
BaseConfig (Interface)
(no doc)
cdk/bin/bedrock-custom-bot.ts
ImportMeta (Interface)
(no doc)
frontend/src/vite-env.d.ts
BedrockSharedKnowledgeBasesStackProps (Interface)
(no doc)
cdk/lib/bedrock-shared-knowledge-bases-stack.ts
KnowledgeConfig (Interface)
(no doc)
cdk/bin/bedrock-custom-bot.ts
GenerationConfigProps (Interface)
(no doc)
frontend/src/components/GenerationConfig.tsx
BedrockKnowledgeBaseProps (Interface)
(no doc)
cdk/lib/bedrock-shared-knowledge-bases-stack.ts

Core symbols most depended-on inside this repo

store_bot
called by 33
backend/app/repositories/custom_bot.py
delete_bot_by_id
called by 33
backend/app/repositories/custom_bot.py
find_bot_by_id
called by 30
backend/app/repositories/custom_bot.py
get_bot_table_client
called by 29
backend/app/repositories/common.py
getEnvVar
called by 28
cdk/lib/utils/parameter-models.ts
create_test_user
called by 24
backend/tests/test_usecases/utils/user_factory.py
compose_sk
called by 22
backend/app/repositories/common.py
create_test_private_bot
called by 22
backend/tests/test_repositories/utils/bot_factory.py

Shape

Function 747
Method 386
Class 283
Route 78
Interface 44
Enum 1

Languages

Python70%
TypeScript30%

Modules by API surface

backend/app/repositories/models/conversation.py76 symbols
backend/tests/test_usecases/test_global_config.py59 symbols
backend/app/repositories/models/custom_bot.py53 symbols
backend/tests/test_usecases/test_chat.py42 symbols
backend/app/routes/schemas/bot.py39 symbols
backend/tests/test_usecases/test_bot.py37 symbols
backend/app/bedrock.py35 symbols
backend/tests/test_repositories/test_custom_bot.py32 symbols
backend/app/repositories/custom_bot.py30 symbols
backend/app/routes/schemas/conversation.py28 symbols
docs/migration/migrate_v2_v3.py26 symbols
backend/app/routes/bot.py26 symbols

For agents

$ claude mcp add bedrock-chat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact