Skip to content

Commit bd24e8c

Browse files
committed
feat: add source region selection and standardize configuration display
This commit introduces several improvements to the Claude Code with Bedrock CLI: ## Model Configuration Enhancements - Added source region selection during init for cross-region inference profiles - Users can now select specific source regions within their chosen profile (US/Europe/APAC) - Moved model configuration from top-level settings.json field to environment variables - Set ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL env vars based on selected model - For Opus models, automatically configure Haiku as the small/fast model variant ## Configuration Display Improvements - Created shared display utility for consistent configuration output - Standardized output between status and package commands - Added missing fields: Client ID, Analytics status, Source Region - Clarified profile naming (Configuration Profile vs AWS Profile) - Enhanced Identity Pool display to show both name and ID when available ## Code Quality and Modernization - Updated type hints to use modern Python 3.9+ syntax (dict instead of Dict, list instead of List) - Fixed linting issues across the codebase - Removed redundant imports and organized import statements - Applied consistent code formatting ## Documentation Updates - Updated CLI_REFERENCE.md with model and source region selection details - Enhanced DEPLOYMENT.md to describe the model selection process - Updated README.md to explain cross-region inference configuration options ## Testing - All 70 tests passing - Removed redundant package display test - Updated tests to check for environment variables instead of top-level model field This update ensures users have better control over their Bedrock model configuration while maintaining backward compatibility with existing deployments.
1 parent 0d7abcd commit bd24e8c

File tree

21 files changed

+1368
-721
lines changed

21 files changed

+1368
-721
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ The guidance can be deployed in any AWS region that supports:
169169
- Amazon Bedrock
170170
- (Optional) Amazon ECS Fargate for monitoring
171171

172-
Users can access Bedrock in any region you configure during setup, regardless of where the authentication infrastructure is deployed.
172+
### Cross-Region Inference
173+
174+
Claude Code uses Amazon Bedrock's cross-region inference for optimal performance and availability. During setup, you can:
175+
- Select your preferred Claude model (Opus, Sonnet, Haiku)
176+
- Choose a cross-region profile (US, Europe, APAC) for optimal regional routing
177+
- Select a specific source region within your profile for model inference
178+
179+
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.
173180

174181
## Implementation
175182

@@ -185,7 +192,7 @@ The wizard will guide you through:
185192

186193
- OIDC provider configuration (domain, client ID)
187194
- AWS region selection for infrastructure
188-
- Amazon Bedrock region access configuration
195+
- Amazon Bedrock cross-region inference configuration
189196
- Credential storage method (keyring or session files)
190197
- Optional monitoring setup with VPC configuration
191198

assets/docs/CLI_REFERENCE.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ poetry run ccwb init [options]
5959
- Checks prerequisites (AWS CLI, credentials, Python version)
6060
- Prompts for OIDC provider configuration
6161
- Configures AWS settings (region, identity pool name)
62+
- Prompts for Claude model selection (Opus, Sonnet, Haiku)
63+
- Configures cross-region inference profiles (US, Europe, APAC)
64+
- Prompts for source region selection for model inference
6265
- Sets up monitoring options
6366
- Saves configuration to `.ccwb-config/config.json` in the project directory
6467

@@ -141,9 +144,12 @@ poetry run ccwb package [options]
141144
- OIDC provider settings
142145
- Identity Pool ID from deployed stack
143146
- Credential storage method (keyring or session)
147+
- Selected Claude model and cross-region profile
148+
- Source region for model inference
144149
- Generates installer script
145150
- Creates user documentation
146151
- Includes Claude Code telemetry settings (if monitoring enabled)
152+
- Configures environment variables for model selection (ANTHROPIC_MODEL, ANTHROPIC_SMALL_FAST_MODEL)
147153

148154
**Output structure:**
149155

@@ -176,10 +182,15 @@ poetry run ccwb status [options]
176182

177183
**What it does:**
178184

179-
- Shows current configuration
185+
- Shows current configuration including:
186+
- Configuration profile and AWS profile names
187+
- OIDC provider and client ID
188+
- Selected Claude model and cross-region profile
189+
- Source region for model inference
190+
- Analytics and monitoring status
180191
- Checks CloudFormation stack status
181192
- Displays Identity Pool information
182-
- Shows monitoring configuration
193+
- Shows monitoring configuration and endpoints
183194

184195
### `cleanup` - Remove Installed Components
185196

assets/docs/DEPLOYMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ poetry install
3434

3535
The `ccwb` (Claude Code with Bedrock) CLI tool guides you through deployment with an interactive wizard. Run `poetry run ccwb init` to begin. The wizard walks you through each configuration decision, starting with your OIDC provider details - enter the domain and Client ID you noted earlier.
3636

37-
Next, you'll choose AWS regions. Select where to deploy the authentication infrastructure (typically your primary AWS region) and which regions users should access Bedrock from. The wizard also offers optional monitoring setup, which provides usage analytics and cost tracking through OpenTelemetry.
37+
Next, you'll select your Claude model and configure regional access. Choose from available Claude models (Opus, Sonnet, Haiku) and select a cross-region inference profile (US, Europe, or APAC) for optimal performance. The wizard will then prompt you to select a source region within your chosen profile for model inference. Finally, choose where to deploy the authentication infrastructure (typically your primary AWS region) and configure optional monitoring setup, which provides usage analytics and cost tracking through OpenTelemetry.
3838

3939
Once configuration is complete, deploy the infrastructure with:
4040

deployment/infrastructure/cognito-identity-pool.yaml

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ Parameters:
6060

6161
AllowedBedrockRegions:
6262
Type: CommaDelimitedList
63-
Default: 'us-east-1,us-west-2,us-east-2'
64-
Description: Comma-delimited list of AWS regions where Bedrock access is allowed
63+
Default: 'us-east-1,us-east-2,us-west-1,us-west-2,eu-west-1,eu-west-3,eu-central-1,eu-north-1,eu-south-1,eu-south-2,ap-northeast-1,ap-southeast-1,ap-southeast-2,ap-southeast-3,ap-south-1'
64+
Description: AWS regions allowed for Bedrock access (configured based on selected model and cross-region profile)
6565

6666
EnableMonitoring:
6767
Type: String
@@ -94,21 +94,17 @@ Resources:
9494
AllowUnauthenticatedIdentities: true
9595
AllowClassicFlow: false
9696
# For External OIDC providers
97-
OpenIdConnectProviderARNs:
98-
!If
99-
- UseExternalOIDC
100-
-
101-
- !GetAtt OIDCProvider.Arn
102-
- !Ref 'AWS::NoValue'
97+
OpenIdConnectProviderARNs: !If
98+
- UseExternalOIDC
99+
- - !GetAtt OIDCProvider.Arn
100+
- !Ref 'AWS::NoValue'
103101
# For Cognito User Pool
104-
CognitoIdentityProviders:
105-
!If
106-
- UseCognitoUserPool
107-
-
108-
- ClientId: !Ref CognitoUserPoolClientId
109-
ProviderName: !Sub 'cognito-idp.${AWS::Region}.amazonaws.com/${CognitoUserPoolId}'
110-
ServerSideTokenCheck: true
111-
- !Ref 'AWS::NoValue'
102+
CognitoIdentityProviders: !If
103+
- UseCognitoUserPool
104+
- - ClientId: !Ref CognitoUserPoolClientId
105+
ProviderName: !Sub 'cognito-idp.${AWS::Region}.amazonaws.com/${CognitoUserPoolId}'
106+
ServerSideTokenCheck: true
107+
- !Ref 'AWS::NoValue'
112108

113109
# IAM OIDC Provider (only for External OIDC)
114110
OIDCProvider:
@@ -123,10 +119,12 @@ Resources:
123119
- '0000000000000000000000000000000000000000'
124120

125121
# Managed Policy for Bedrock Access
122+
# Note: Cross-region inference requires access to all regions in the profile (us-east-1, us-east-2, us-west-2)
123+
# as requests may be routed to any of these regions automatically
126124
BedrockAccessPolicy:
127125
Type: AWS::IAM::ManagedPolicy
128126
Properties:
129-
Description: Policy for Cognito authenticated users to access Bedrock
127+
Description: Policy for Cognito authenticated users to access Bedrock via cross-region inference
130128
PolicyDocument:
131129
Version: '2012-10-17'
132130
Statement:
@@ -232,20 +230,18 @@ Resources:
232230
DeletionPolicy: Delete
233231
Properties:
234232
IdentityPoolId: !Ref BedrockIdentityPool
235-
IdentityProviderName:
236-
!If
237-
- UseExternalOIDC
238-
- !Ref OIDCProviderDomain
239-
- !Sub 'cognito-idp.${AWS::Region}.amazonaws.com/${CognitoUserPoolId}'
233+
IdentityProviderName: !If
234+
- UseExternalOIDC
235+
- !Ref OIDCProviderDomain
236+
- !Sub 'cognito-idp.${AWS::Region}.amazonaws.com/${CognitoUserPoolId}'
240237
UseDefaults: false
241238
PrincipalTags:
242239
UserEmail: email
243240
UserId: sub
244-
UserName:
245-
!If
246-
- UseCognitoUserPool
247-
- preferred_username
248-
- name
241+
UserName: !If
242+
- UseCognitoUserPool
243+
- preferred_username
244+
- name
249245

250246
# CloudWatch Log Group for Bedrock Access Tracking
251247
BedrockAccessLogGroup:
@@ -389,26 +385,25 @@ Outputs:
389385

390386
ConfigurationJson:
391387
Description: Configuration JSON for CLI tool
392-
Value:
393-
!If
394-
- UseExternalOIDC
395-
- !Sub |
396-
{
397-
"provider_domain": "${OIDCProviderDomain}",
398-
"client_id": "${OIDCClientId}",
399-
"identity_pool_id": "${BedrockIdentityPool}",
400-
"aws_region": "${AWS::Region}",
401-
"provider_type": "${OIDCProviderType}"
402-
}
403-
- !Sub |
404-
{
405-
"provider_domain": "TBD - Use your Cognito User Pool domain",
406-
"client_id": "${CognitoUserPoolClientId}",
407-
"identity_pool_id": "${BedrockIdentityPool}",
408-
"aws_region": "${AWS::Region}",
409-
"provider_type": "cognito",
410-
"cognito_user_pool_id": "${CognitoUserPoolId}"
411-
}
388+
Value: !If
389+
- UseExternalOIDC
390+
- !Sub |
391+
{
392+
"provider_domain": "${OIDCProviderDomain}",
393+
"client_id": "${OIDCClientId}",
394+
"identity_pool_id": "${BedrockIdentityPool}",
395+
"aws_region": "${AWS::Region}",
396+
"provider_type": "${OIDCProviderType}"
397+
}
398+
- !Sub |
399+
{
400+
"provider_domain": "TBD - Use your Cognito User Pool domain",
401+
"client_id": "${CognitoUserPoolClientId}",
402+
"identity_pool_id": "${BedrockIdentityPool}",
403+
"aws_region": "${AWS::Region}",
404+
"provider_type": "cognito",
405+
"cognito_user_pool_id": "${CognitoUserPoolId}"
406+
}
412407
413408
BedrockLogGroupName:
414409
Description: CloudWatch Log Group for Bedrock access tracking
@@ -429,4 +424,4 @@ Outputs:
429424
Condition: BedrockTrackingEnabled
430425
Value: !Ref CloudTrailBucket
431426
Export:
432-
Name: !Sub '${AWS::StackName}-CloudTrailBucket'
427+
Name: !Sub '${AWS::StackName}-CloudTrailBucket'

source/claude_code_with_bedrock/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"""Claude Code with Bedrock - Enterprise deployment tool."""
55

66
__version__ = "1.0.0"
7-
__all__ = ["cli", "auth", "bedrock", "monitoring"]
7+
__all__ = ["cli", "auth", "bedrock", "monitoring"]

source/claude_code_with_bedrock/cli/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
"""Command-line interface for Claude Code with Bedrock."""
55

66
from cleo.application import Application
7-
from cleo.commands.command import Command
8-
from cleo.helpers import argument, option
97

10-
from .commands.init import InitCommand
8+
from .commands.cleanup import CleanupCommand
119
from .commands.deploy import DeployCommand
10+
from .commands.destroy import DestroyCommand
11+
from .commands.init import InitCommand
12+
from .commands.package import PackageCommand
1213
from .commands.status import StatusCommand
1314
from .commands.test import TestCommand
14-
from .commands.package import PackageCommand
15-
from .commands.destroy import DestroyCommand
16-
from .commands.cleanup import CleanupCommand
15+
1716
# TokenCommand temporarily disabled - not implemented
1817

1918

@@ -23,7 +22,7 @@ def create_application() -> Application:
2322
"claude-code-with-bedrock",
2423
"1.0.0"
2524
)
26-
25+
2726
# Add commands
2827
application.add(InitCommand())
2928
application.add(DeployCommand())
@@ -33,7 +32,7 @@ def create_application() -> Application:
3332
application.add(DestroyCommand())
3433
application.add(CleanupCommand())
3534
# application.add(TokenCommand()) # Temporarily disabled
36-
35+
3736
return application
3837

3938

@@ -44,4 +43,4 @@ def main():
4443

4544

4645
if __name__ == "__main__":
47-
main()
46+
main()

source/claude_code_with_bedrock/cli/commands/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
"""CLI commands for Claude Code with Bedrock."""
55

6-
from .init import InitCommand
76
from .deploy import DeployCommand
7+
from .destroy import DestroyCommand
8+
from .init import InitCommand
9+
from .package import PackageCommand
810
from .status import StatusCommand
911
from .test import TestCommand
10-
from .package import PackageCommand
11-
from .destroy import DestroyCommand
1212

1313
__all__ = [
1414
"InitCommand",
@@ -17,4 +17,4 @@
1717
"TestCommand",
1818
"PackageCommand",
1919
"DestroyCommand"
20-
]
20+
]

0 commit comments

Comments
 (0)