Using Claude Code Through AWS Bedrock or GCP Vertex AI
If your organization uses AWS or Google Cloud, you can run Claude Code through their managed AI services instead of using a direct Anthropic API key. This lesson covers both options.
Option A: AWS Bedrock
AWS Bedrock gives you Claude access through your existing AWS account with enterprise-grade security and compliance.
Step 1: Enable Claude Models in Bedrock
- Open the AWS Console and navigate to Amazon Bedrock
- Go to Model access in the left sidebar
- Request access to Anthropic Claude models
- Wait for approval (usually instant for most models)
Step 2: Configure Claude Code for Bedrock
# Set the provider to Bedrock
export CLAUDE_CODE_USE_BEDROCK=1
# Configure your AWS credentials (if not already set)
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="us-east-1"
# Or use AWS SSO / IAM roles (recommended)
aws configure sso
Step 3: Verify the Connection
claude
> Hello, which model and provider am I connected to?
Bedrock Pricing Considerations:
- Bedrock pricing differs from direct API pricing
- You can use Provisioned Throughput for predictable costs
- Cross-region inference is available for higher availability
Option B: GCP Vertex AI
Google Cloud Vertex AI provides Claude access integrated with GCP IAM and billing.
Step 1: Enable the Vertex AI API
gcloud services enable aiplatform.googleapis.com
Step 2: Configure Claude Code for Vertex AI
# Set the provider to Vertex AI
export CLAUDE_CODE_USE_VERTEX=1
# Configure your GCP project
export CLOUD_ML_PROJECT_ID="your-project-id"
export CLOUD_ML_REGION="us-east5"
# Authenticate
gcloud auth application-default login
Step 3: Verify the Connection
claude
> Confirm my connection details
When to Use Each Option
| Consideration | Direct API | AWS Bedrock | GCP Vertex AI |
|---|---|---|---|
| Setup speed | Fastest | Moderate | Moderate |
| Enterprise compliance | Basic | SOC2, HIPAA ready | SOC2, HIPAA ready |
| Billing | Anthropic account | AWS consolidated | GCP consolidated |
| Best for | Individual devs | AWS-heavy orgs | GCP-heavy orgs |
Key Takeaways
- Claude Code works with direct API, AWS Bedrock, and GCP Vertex AI
- Enterprise teams benefit from cloud provider integration for compliance and billing
- Configuration requires setting environment variables for your chosen provider
- All three options provide identical Claude Code functionality