Complete deployment walkthrough for IT administrators deploying Claude Code with Amazon Bedrock.
Time Required: 2-3 hours for initial deployment Skill Level: AWS administrator with IAM/CloudFormation experience
- Python 3.10-3.13
- Poetry (dependency management)
- AWS CLI v2
- Git
- AWS account with appropriate IAM permissions to create:
- CloudFormation stacks
- IAM OIDC Providers or Cognito Identity Pools
- IAM roles and policies
- (Optional) Amazon Elastic Container Service (Amazon ECS) tasks and Amazon CloudWatch dashboards
- (Optional) Amazon Athena, AWS Glue, AWS Lambda, and Amazon Data Firehose resources
- (Optional) AWS CodeBuild
- Amazon Bedrock activated in target regions
- Existing OIDC identity provider (Okta, Azure AD, Auth0, etc.)
- Ability to create OIDC applications
- Redirect URI support for
http://localhost:8400/callback
The guidance can be deployed in any AWS region that supports:
- IAM OIDC Providers or Amazon Cognito Identity Pools
- Amazon Bedrock
- (Optional) Amazon Elastic Container Service (Amazon ECS) tasks and Amazon CloudWatch dashboards
- (Optional) Amazon Athena, AWS Glue, AWS Lambda, and Amazon Data Firehose resources
- (Optional) AWS CodeBuild
Claude Code uses Amazon Bedrock's cross-region inference for optimal performance and availability. During setup, you can:
- Select your preferred Claude model (Opus, Sonnet, Haiku)
- Choose a cross-region profile (US, Europe, APAC) for optimal regional routing
- Select a specific source region within your profile for model inference
This automatically routes requests across multiple AWS regions to ensure the best response times and highest availability. Modern Claude models (3.7+) require cross-region inference for access.
# Clone the repository
git clone https://github.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock
cd guidance-for-claude-code-with-amazon-bedrock/source
# Install dependencies
poetry installRun the interactive setup wizard:
poetry run ccwb initThe wizard will guide you through:
- OIDC provider configuration (domain, client ID)
- AWS region selection for infrastructure
- Amazon Bedrock cross-region inference configuration
- Credential storage method (keyring or session files)
- Optional monitoring setup with VPC configuration
What are profiles? Profiles let you manage multiple deployments from one machine (different AWS accounts, regions, or organizations).
Common use cases:
- Production vs development accounts
- US vs EU regional deployments
- Multiple customer/tenant deployments
Profile commands:
ccwb context list- See all profilesccwb context use <name>- Switch between profilesccwb context show- View active profile details
See CLI Reference for complete command list.
Upgrading from v1.x: Profile configuration automatically migrates from source/.ccwb-config/ to ~/.ccwb/ on first run. Your profile names and active profile are preserved. A timestamped backup is created automatically.
Deploy the AWS CloudFormation stacks:
poetry run ccwb deployThis creates the following AWS resources:
Authentication Infrastructure:
- IAM OIDC Provider or Amazon Cognito Identity Pool for OIDC federation
- IAM trust relationship for federated access
- IAM role with policies for:
- Bedrock model invocation in specified regions
- CloudWatch metrics (if monitoring enabled)
Optional Monitoring Infrastructure:
- VPC and networking resources (or integration with existing VPC)
- ECS Fargate cluster running OpenTelemetry collector
- Application Load Balancer for OTLP ingestion
- CloudWatch Log Groups and Metrics
- CloudWatch Dashboard with comprehensive usage analytics
- DynamoDB table for metrics aggregation and storage
- Lambda functions for custom dashboard widgets
- Kinesis Data Firehose for streaming metrics to S3 (if analytics enabled)
- Amazon Athena for SQL analytics on collected metrics (if analytics enabled)
- S3 bucket for long-term metrics storage (if analytics enabled)
Build the package for end users:
# Build all platforms (starts Windows build in background)
poetry run ccwb package --target-platform all
# Check Windows build status (optional)
poetry run ccwb builds
# When ready, create distribution URL (optional)
poetry run ccwb distributePackage Workflow:
- Local builds: macOS/Linux executables are built locally using PyInstaller
- Windows builds: Trigger AWS CodeBuild for Windows executables (20+ minutes) - requires enabling CodeBuild during
init - Check status: Monitor build progress with
poetry run ccwb builds - Create distribution: Use
distributeto upload and generate presigned URLs
Note: Windows builds are optional and require CodeBuild to be enabled during the
initprocess. If not enabled, the package command will skip Windows builds and continue with other platforms.
The dist/ folder will contain:
credential-process-macos-arm64- Authentication executable for macOS ARM64credential-process-macos-intel- Authentication executable for macOS Intel (if built)credential-process-windows.exe- Authentication executable for Windowscredential-process-linux- Authentication executable for Linux (if built on Linux)config.json- Embedded configurationinstall.sh- Installation script for Unix systemsinstall.bat- Installation script for WindowsREADME.md- User instructions.claude/settings.json- Claude Code telemetry settings (if monitoring enabled)otel-helper-*- OTEL helper executables for each platform (if monitoring enabled)
The package builder:
- Automatically builds binaries for both macOS and Linux by default
- Uses Docker for cross-platform Linux builds when running on macOS
- Includes the OTEL helper for extracting user attributes from JWT tokens
- Creates a unified installer that auto-detects the user's platform
Verify everything works correctly:
poetry run ccwb testThis will:
- Simulate the end-user installation process
- Test OIDC authentication
- Verify AWS credential retrieval
- Check Amazon Bedrock access
- (Optional) Test actual API calls with
--apiflag
You have three options for sharing packages with users. The distribution method is configured during ccwb init (Step 2).
No additional infrastructure required. Share the built packages directly:
# Navigate to dist directory
cd dist
# Create a zip file of all packages
zip -r claude-code-packages.zip .
# Share via email or internal file sharing
# Users extract and run install.sh (Unix) or install.bat (Windows)Best for: Any size team, no automation required
Automated distribution via time-limited S3 URLs:
poetry run ccwb distributeGenerates presigned URLs (default 48-hour expiry) that you share with users via email or messaging.
Best for: Automated distribution without authentication requirements
Setup: Select "presigned-s3" distribution type during ccwb init (Step 2)
Self-service portal with IdP authentication:
# Deploy landing page infrastructure (if not done during Step 3)
poetry run ccwb deploy distribution
# Upload packages to landing page
poetry run ccwb distributeUsers visit your landing page URL, authenticate with SSO, and download packages for their platform.
Best for: Self-service portal with compliance and audit requirements
Setup: Select "landing-page" distribution type during ccwb init (Step 2), then deploy distribution infrastructure
See Distribution Comparison for detailed feature comparison and setup guides.
- Windows: AWS CodeBuild with Nuitka (automated)
- macOS: PyInstaller with architecture-specific builds
- ARM64: Native build on Apple Silicon Macs
- Intel: Optional - requires x86_64 Python environment on ARM Macs
- Universal: Requires both architectures' Python libraries
- Linux: Docker with PyInstaller (for building on non-Linux hosts)
Intel Mac builds require an x86_64 Python environment on Apple Silicon Macs.
See CLI Reference - Intel Mac Build Setup for setup instructions.
If not configured, the package command will skip Intel builds and continue with other platforms.
You are responsible for the costs of AWS services while running this guidance. If you decide that you no longer need the guidance, please ensure that infrastructure resources are removed.
poetry run ccwb destroyForce re-authentication:
~/claude-code-with-bedrock/credential-process --clear-cacheCheck Windows build status:
poetry run ccwb buildsView stack status:
poetry run ccwb statusFor detailed troubleshooting, see Deployment Guide.
- Architecture Deep Dive - Technical architecture details
- Enable Monitoring - Setup OpenTelemetry monitoring
- Setup Analytics - Configure S3 data lake and Athena queries
- CLI Reference - Complete command reference