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
// 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',
});
Properties
inferenceProfileArnstringinference_profile_arnstrinferenceProfileArnStringInferenceProfileArnstringInferenceProfileArn*stringrequired#inferenceProfileIdstringinference_profile_idstrinferenceProfileIdStringInferenceProfileIdstringInferenceProfileId*stringrequired#Format: {geoRegion}.{modelId}
inferenceProfileModelBedrockFoundationModelinference_profile_modelBedrockFoundationModelinferenceProfileModelBedrockFoundationModelInferenceProfileModelBedrockFoundationModelInferenceProfileModelBedrockFoundationModelrequired#This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
typeInferenceProfileTypetypeInferenceProfileTypetypeInferenceProfileTypeTypeInferenceProfileTypeTypeInferenceProfileTyperequired#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#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#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#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