CrossRegionInferenceProfile
- class aws_cdk.aws_bedrock_alpha.CrossRegionInferenceProfile(*args: Any, **kwargs)
Bases:
object
(experimental) 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.
- See:
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
# 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" )
Methods
- grant_invoke(grantee)
(experimental) 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
- Parameters:
grantee (
IGrantable
) –The IAM principal to grant permissions to.
- Return type:
- Returns:
An IAM Grant object representing the granted permissions
- Stability:
experimental
- grant_profile_usage(grantee)
(experimental) Grants appropriate permissions to use the cross-region inference profile.
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.
- Parameters:
grantee (
IGrantable
) –The IAM principal to grant permissions to.
- Return type:
- Returns:
An IAM Grant object representing the granted permissions
- Stability:
experimental
Attributes
- inference_profile_arn
(experimental) The ARN of the inference profile.
- Stability:
experimental
- Attribute:
true
- inference_profile_id
(experimental) The unique identifier of the inference profile.
Format: {geoRegion}.{modelId}
- Stability:
experimental
- inference_profile_model
(experimental) The underlying foundation model supporting cross-region inference.
- Stability:
experimental
- invokable_arn
(experimental) The ARN used for invoking this inference profile.
This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
- Stability:
experimental
- type
(experimental) The type of inference profile.
Always SYSTEM_DEFINED for cross-region profiles.
- Stability:
experimental
Static Methods
- classmethod from_config(*, geo_region, model)
(experimental) Creates a Cross-Region Inference Profile from the provided configuration.
- Parameters:
geo_region (
CrossRegionInferenceProfileRegion
) – (experimental) The geographic region where the traffic is going to be distributed. Routing factors in user traffic, demand and utilization of resources.model (
BedrockFoundationModel
) – (experimental) A foundation model supporting cross-region inference. The model must have cross-region support enabled.
- Return type:
- Returns:
A new CrossRegionInferenceProfile instance
- Stability:
experimental
- Throws:
ValidationError if the model doesn’t support cross-region inference