Overview
This deployment method:- Creates a CloudFormation stack (
CodeBuildForDeploy) with a CodeBuild project - The CodeBuild project clones the Bedrock Chat repository
- Configures deployment parameters based on your inputs
- Runs CDK bootstrap and deployment commands
- Returns the Frontend URL after ~35 minutes
Prerequisites
Enable Bedrock Model Access
In the us-east-1 region, open Bedrock Model access:
- Click Manage model access
- Select all models you wish to use
- Click Save changes
Choose Deployment Region
Ensure you deploy in a supported region where OpenSearch Serverless is available.
Basic Deployment
Open CloudShell
Open CloudShell in the region where you want to deploy.
Wait for Completion
The deployment takes approximately 35 minutes. Monitor the progress in the CloudShell output.
Deployment with Security Parameters
Deploy with recommended security settings:Available Parameters
Thebin.sh script accepts the following parameters:
Security Parameters
--disable-self-register: Disable self-registration (users must be created in Cognito)--ipv4-ranges: Comma-separated list of allowed IPv4 CIDR ranges--ipv6-ranges: Comma-separated list of allowed IPv6 CIDR ranges--disable-ipv6: Disable IPv6 connections entirely--allowed-signup-email-domains: Comma-separated list of allowed email domains
Configuration Parameters
--bedrock-region: Region where Bedrock is available (default:us-east-1)--enable-lambda-snapstart: Enable Lambda SnapStart for better performance--version: Specific version to deploy (default:v3)--repo-url: Custom repository URL if using a fork
Advanced Parameters
--cdk-json-override: JSON string to override any CDK context values
Advanced Configuration Examples
Example 1: Enterprise Security Setup
Example 2: Development Environment
Example 3: Using CDK JSON Override
Override multiple configuration values at once:CloudFormation Stack Details
Thebin.sh script creates a CloudFormation stack with these resources:
Stack Name
CodeBuildForDeploy
Resources Created
- CodeBuild Project: Executes the CDK deployment
- IAM Role: Service role for CodeBuild with AdministratorAccess
- IAM Policy: Additional permissions for CloudWatch Logs and CodeBuild reports
Environment Variables
The CodeBuild project receives these environment variables from parameters:ALLOW_SELF_REGISTERENABLE_LAMBDA_SNAPSTARTIPV4_RANGESIPV6_RANGESDISABLE_IPV6ALLOWED_SIGN_UP_EMAIL_DOMAINSBEDROCK_REGIONCDK_JSON_OVERRIDEREPO_URLVERSION
Build Process
The CodeBuild project executes these steps:Configure Parameters
- Modifies
cdk/cdk.jsonbased on provided parameters - Applies CDK JSON overrides if provided
Monitoring Deployment
To monitor the deployment progress:- The
bin.shscript shows a spinner while waiting for stack creation - Once the stack is created, it starts the CodeBuild project
- The script waits for the CodeBuild project to complete
- CloudWatch Logs are automatically fetched to display the Frontend URL
- CloudFormation: View stack creation progress
- CodeBuild: View build logs and execution details
- CloudWatch Logs: View detailed CDK deployment logs
Troubleshooting
Deployment Fails with Template Validation Error
Thebin.sh script validates the CloudFormation template before deployment. If validation fails:
Frontend URL Not Appearing
If the Frontend URL doesn’t appear after deployment:Insufficient Storage Error
CodeBuild requires sufficient storage space. If you encounter storage errors, the deployment may fail during CDK bootstrap or package installation.Stack Already Exists
If you see an error that theCodeBuildForDeploy stack already exists:
- Delete the existing stack in CloudFormation
- Re-run the deployment script
Cleanup
To remove all deployed resources:Delete Main Stack
Go to CloudFormation and delete
BedrockChatStack.Next Steps
Configure Parameters
Learn about all available deployment parameters
Security Configuration
Configure security settings for production
User Management
Set up users and groups
Custom Domains
Configure a custom domain name