Class CrossRegionInferenceProfile
- All Implemented Interfaces:
IBedrockInvokable,IInferenceProfile,software.amazon.jsii.JsiiSerializable
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
CrossRegionInferenceProfile crossRegionProfile = CrossRegionInferenceProfile.fromConfig(CrossRegionInferenceProfileProps.builder()
.geoRegion(CrossRegionInferenceProfileRegion.US)
.model(BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0)
.build());
// Use the cross-region profile with an agent
Agent agent = Agent.Builder.create(this, "Agent")
.foundationModel(crossRegionProfile)
.instruction("You are a helpful and friendly agent that answers questions about agriculture.")
.build();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.alpha.IBedrockInvokable
IBedrockInvokable.Jsii$Default, IBedrockInvokable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.alpha.IInferenceProfile
IInferenceProfile.Jsii$Default, IInferenceProfile.Jsii$Proxy -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCrossRegionInferenceProfile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCrossRegionInferenceProfile(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic CrossRegionInferenceProfile(experimental) Creates a Cross-Region Inference Profile from the provided configuration.(experimental) The ARN of the inference profile.(experimental) The unique identifier of the inference profile.(experimental) The underlying foundation model supporting cross-region inference.(experimental) The ARN used for invoking this inference profile.getType()(experimental) The type of inference profile.grantInvoke(IGrantable grantee) (experimental) Gives the appropriate policies to invoke and use the Foundation Model.grantProfileUsage(IGrantable grantee) (experimental) Grants appropriate permissions to use the cross-region inference profile.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
CrossRegionInferenceProfile
protected CrossRegionInferenceProfile(software.amazon.jsii.JsiiObjectRef objRef) -
CrossRegionInferenceProfile
protected CrossRegionInferenceProfile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
fromConfig
@Stability(Experimental) @NotNull public static CrossRegionInferenceProfile fromConfig(@NotNull CrossRegionInferenceProfileProps config) (experimental) Creates a Cross-Region Inference Profile from the provided configuration.- Parameters:
config-- Configuration for the cross-region inference profile.
- Returns:
- A new CrossRegionInferenceProfile instance
-
grantInvoke
(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
- Specified by:
grantInvokein interfaceIBedrockInvokable- Parameters:
grantee-- The IAM principal to grant permissions to.
- Returns:
- An IAM Grant object representing the granted permissions
-
grantProfileUsage
(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.
- Specified by:
grantProfileUsagein interfaceIInferenceProfile- Parameters:
grantee-- The IAM principal to grant permissions to.
- Returns:
- An IAM Grant object representing the granted permissions
-
getInferenceProfileArn
(experimental) The ARN of the inference profile.- Specified by:
getInferenceProfileArnin interfaceIInferenceProfile
-
getInferenceProfileId
(experimental) The unique identifier of the inference profile.Format: {geoRegion}.{modelId}
- Specified by:
getInferenceProfileIdin interfaceIInferenceProfile
-
getInferenceProfileModel
(experimental) The underlying foundation model supporting cross-region inference. -
getInvokableArn
(experimental) The ARN used for invoking this inference profile.This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
- Specified by:
getInvokableArnin interfaceIBedrockInvokable
-
getType
(experimental) The type of inference profile.Always SYSTEM_DEFINED for cross-region profiles.
- Specified by:
getTypein interfaceIInferenceProfile
-