Skip to content
v2.277.0

Experimental

@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

CrossRegionInferenceProfile Class ​

Cross-region inference enables you to seamlessly manage unplanned traffic bursts by utilizing compute across different AWS Regions.

With cross-region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput and enhanced resilience during periods of peak demands.

This construct represents a system-defined inference profile that routes requests across multiple regions based on availability and demand.

Example ​

ts
// Create a cross-region inference profile
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
  geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
  model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0,
});

// Create an application inference profile across regions
const appProfile = new bedrock.ApplicationInferenceProfile(this, 'MyMultiRegionProfile', {
  applicationInferenceProfileName: 'claude-35-sonnet-v2-multi-region',
  modelSource: crossRegionProfile,
  description: 'Multi-region application profile for cost tracking',
});
python
# Create a cross-region inference profile
cross_region_profile = bedrock.CrossRegionInferenceProfile.from_config(
    geo_region=bedrock.CrossRegionInferenceProfileRegion.US,
    model=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0
)

# Create an application inference profile across regions
app_profile = bedrock.ApplicationInferenceProfile(self, "MyMultiRegionProfile",
    application_inference_profile_name="claude-35-sonnet-v2-multi-region",
    model_source=cross_region_profile,
    description="Multi-region application profile for cost tracking"
)
java
// Create a cross-region inference profile
CrossRegionInferenceProfile crossRegionProfile = CrossRegionInferenceProfile.fromConfig(CrossRegionInferenceProfileProps.builder()
        .geoRegion(CrossRegionInferenceProfileRegion.US)
        .model(BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0)
        .build());

// Create an application inference profile across regions
ApplicationInferenceProfile appProfile = ApplicationInferenceProfile.Builder.create(this, "MyMultiRegionProfile")
        .applicationInferenceProfileName("claude-35-sonnet-v2-multi-region")
        .modelSource(crossRegionProfile)
        .description("Multi-region application profile for cost tracking")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Alpha
// Create a cross-region inference profile
var crossRegionProfile = CrossRegionInferenceProfile.FromConfig(new CrossRegionInferenceProfileProps {
    GeoRegion = CrossRegionInferenceProfileRegion.US,
    Model = BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0
});

// Create an application inference profile across regions
var appProfile = new ApplicationInferenceProfile(this, "MyMultiRegionProfile", new ApplicationInferenceProfileProps {
    ApplicationInferenceProfileName = "claude-35-sonnet-v2-multi-region",
    ModelSource = crossRegionProfile,
    Description = "Multi-region application profile for cost tracking"
});
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockalpha/v2
// Create a cross-region inference profile
crossRegionProfile := bedrock.CrossRegionInferenceProfile_FromConfig(&CrossRegionInferenceProfileProps{
	GeoRegion: bedrock.CrossRegionInferenceProfileRegion_US,
	Model: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V2_0(),
})

// Create an application inference profile across regions
appProfile := bedrock.NewApplicationInferenceProfile(this, jsii.String("MyMultiRegionProfile"), &ApplicationInferenceProfileProps{
	ApplicationInferenceProfileName: jsii.String("claude-35-sonnet-v2-multi-region"),
	ModelSource: crossRegionProfile,
	Description: jsii.String("Multi-region application profile for cost tracking"),
})

Properties ​

inferenceProfileArnstringinference_profile_arnstrinferenceProfileArnStringInferenceProfileArnstringInferenceProfileArn*string#
The ARN of the inference profile.
inferenceProfileIdstringinference_profile_idstrinferenceProfileIdStringInferenceProfileIdstringInferenceProfileId*string#
The unique identifier of the inference profile.

Format: {geoRegion}.{modelId}

inferenceProfileModelBedrockFoundationModelinference_profile_modelBedrockFoundationModelinferenceProfileModelBedrockFoundationModelInferenceProfileModelBedrockFoundationModelInferenceProfileModelBedrockFoundationModel#
The underlying foundation model supporting cross-region inference.
invokableArnstringinvokable_arnstrinvokableArnStringInvokableArnstringInvokableArn*string#
The ARN used for invoking this inference profile.

This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.

The type of inference profile.

Always SYSTEM_DEFINED for cross-region profiles.

Methods ​

fromConfig(config: CrossRegionInferenceProfileProps): CrossRegionInferenceProfile // chainable@staticmethod def from_config(config: CrossRegionInferenceProfileProps) -> CrossRegionInferenceProfilepublic static CrossRegionInferenceProfile fromConfig(CrossRegionInferenceProfileProps config)public static CrossRegionInferenceProfile FromConfig(CrossRegionInferenceProfileProps config)func FromConfig(Config CrossRegionInferenceProfileProps) CrossRegionInferenceProfilestatic#
Creates a Cross-Region Inference Profile from the provided configuration.
1 parameter · returns

Parameters

  • configconfigconfigconfigConfig — - Configuration for the cross-region inference profile.

Returns: A new CrossRegionInferenceProfile instance

grantInvoke(grantee: IGrantable): Grantdef grant_invoke(self, grantee: IGrantable) -> Grantpublic Grant grantInvoke(IGrantable grantee)public Grant GrantInvoke(IGrantable grantee)func GrantInvoke(Grantee IGrantable) Grant#
Gives the appropriate policies to invoke and use the Foundation Model.

For cross-region inference profiles, this method grants permissions to:

  • Invoke the model in all regions where the inference profile can route requests
  • Use the inference profile itself [disable-awslint:no-grants]
1 parameter · returns

Parameters

  • granteegranteegranteegranteeGrantee — - The IAM principal to grant permissions to.

Returns: An IAM Grant object representing the granted permissions

grantProfileUsage(grantee: IGrantable): Grantdef grant_profile_usage(self, grantee: IGrantable) -> Grantpublic Grant grantProfileUsage(IGrantable grantee)public Grant GrantProfileUsage(IGrantable grantee)func GrantProfileUsage(Grantee IGrantable) Grant#
Grants appropriate permissions to use the cross-region inference profile.
notes · 1 parameter · returns

This method adds the necessary IAM permissions to allow the grantee to:

  • Get inference profile details (bedrock:GetInferenceProfile)
  • Invoke the model through the inference profile (bedrock:InvokeModel*)

Note: This does not grant permissions to use the underlying model directly. For comprehensive permissions, use grantInvoke() instead. [disable-awslint:no-grants]

Parameters

  • granteegranteegranteegranteeGrantee — - The IAM principal to grant permissions to.

Returns: An IAM Grant object representing the granted permissions