
Claude Code on Amazon Bedrock: Quick Setup Guide
Configure Anthropic's AI Coding Assistant with AWS Bedrock
Benefits of Using Claude Code with Amazon Bedrock
Setting up Claude Code with Amazon Bedrock
Choose your primary model (pick ONE):
Option 1: Claude Opus 4 (most powerful - best for complex challenges)
Option 2: Claude Sonnet 4 (recommended - great balance of speed and capability)
Option 3: Claude Sonnet 3.7 (previous generation)
Project Initialization with /init
Accepting and Reviewing Code Additions from Claude Code
Best Practices for Code Review
Managing Context with the /compact Command
Monitoring Your Costs with Claude Code
Additional Resources and Continued Learning
Building a Calculator Web App with Claude Code: A Step-by-Step Tutorial
- IDE Integration: Seamlessly integrates with VS Code, Cursor, Windsurf, and JetBrains IDEs (PyCharm, WebStorm, IntelliJ, GoLand)
- Quick Access: Launch with Cmd+Esc (Mac) or Ctrl+Esc (Windows/Linux) directly from your editor
- Smart Context: Automatically shares your current selection, open tabs, and diagnostic errors with Claude
- Visual Diffs: View and apply code changes directly in your IDE's diff viewer
- Core Capabilities: Edits files, fixes bugs, answers architecture questions, executes tests, resolves merge conflicts, and more
- Primary model: Any Claude 3.7+ or Claude 4 model (Sonnet or Opus) that handles complex code understanding, generation, and reasoning tasks
- Claude 3.7 Sonnet or higher recommended for optimal performance
- Claude 4 models provide enhanced capabilities
- Opus models offer the most powerful processing for complex challenges
- Claude 3.5 Haiku: A lightweight model used for background functionality within Claude Code:
- Generates small creative messages that appear while you type
- Powers conversation summarization for the
claude --resume
feature - Handles various background processes with minimal token usage
- Typically consumes under $0.04 per session for these background tasks
⚠️ IMPORTANT ⚠️: You must explicitly enable access to both model types in your AWS Bedrock Model Access settings for the region you're using: (1) Primary model - Any Claude 3.7+ or Claude 4 model (Sonnet or Opus), and (2) Claude 3.5 Haiku - Required for background functionality. Failure to enable both a primary model AND Haiku will result in 403 Forbidden errors when using Claude Code. 🔑 🚫
See the AWS Bedrock Getting Started Guide for instructions on enabling model access.
- Leverage your existing AWS Bedrock allocation and billing
- Access to Claude 4 Opus and Sonnet's advanced coding capabilities
- Keep your code interactions within your AWS infrastructure
- Maintain consistent security and compliance standards
- Use of prompt caching for cost optimization (learn more about Claude Code prompt caching on Bedrock)
- Operating Systems: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows via WSL
- Hardware: 4GB RAM minimum
- Software:
- Node.js 18+
- git 2.23+ (optional)
- GitHub or GitLab CLI for PR workflows (optional)
- ripgrep (rg) for enhanced file search (optional)
- Network: Internet connection required for authentication and AI processing
https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-configure.html
- Using AWS CLI (easiest method):
- Run
aws configure
- Enter your access key, secret key, default region (ensure you have Bedrock access in that region), and set output to json.
- Manual Configuration:
- Create credential files in
~/.aws/credentials
and~/.aws/config
/init
- Generates a comprehensive
CLAUDE.md
guide for your project - Creates documentation tailored to your specific codebase
- Helps new team members understand the project structure
- Provides a reference for working with Claude Code in your project
- Start Claude Code in your project directory with
claude
- Type
/init
in the interactive REPL - Claude will analyze your codebase and generate the guide
- Review the generated
CLAUDE.md
file - Optionally commit the file to your repository with
claude commit
- Claude Code uses a human in the loop permission system for safety
- File modifications require explicit approval by default
- You'll be prompted to confirm before changes are made
- Carefully examine suggested changes before approving them
- Understand what the code does - ask Claude to explain if needed
- Check for edge cases that might not have been considered
- Verify security implications of any code that handles sensitive data
- Test the changes after they're applied to ensure they work as expected
/compact
command is a powerful tool for managing context and maintaining efficient conversations with Claude Code:- What it does: Summarizes your conversation history into a concise format
- Benefits: Preserves essential information while reducing token count
- When to use: After completing major tasks, when responses slow down, or before starting new subtasks
- Token savings: Significantly reduces token usage, helping manage costs even with prompt caching
/compact
regularly is a best practice for maintaining coherent and efficient interactions with Claude Code, especially for complex coding tasks that require extended conversations.- During a session: Use the
/cost
command to see current token usage and estimated costs - Session summary: View a cost summary automatically displayed when exiting Claude Code
- Set spend limits: Configure spending thresholds through your account settings
summarize this project
to test your setup. You can also generate a project guide with the /init
command.- Build a complete calculator web application from scratch
- Demonstrate Claude Code's capabilities for code generation and enhancement
- Show how to add scientific calculator functions to an existing project
- Explore best practices for working with AI coding assistants
- Provide practical examples of context management with
/compact
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.