aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.7k stars 3.93k forks source link

Bedrock: Cross Region Inference capability #31570

Open medha-hegde opened 2 months ago

medha-hegde commented 2 months ago

Describe the feature

The new cross-region inference profiles allow us to use the same Bedrock model in other regions by switching out the foundation model ARN with this inference profile ARN:

image

However, in the Amazon Bedrock Construct Library only allows for Foundation Models or Provisioned Models.

Can we incorprate this new cross-region inference profiles feature ASAP?

Use Case

I am invoking the Bedrock API via Step Functions tasks with this code currently:

claude_model_id = bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_V2_1
invoke_model = tasks.BedrockInvokeModel(
        scope,
        id + " (Invoke Model)",
        model=bedrock.FoundationModel.from_foundation_model_id(
            scope,
            "Model",
            claude_model_id,
        ),...

ideally I'd like to simply switch out the claude_model_id for the inference profile ARN.

Proposed Solution

Allow for custom ARNs instead of enforcing the bedrock.FoundationModelIdentifier class for the model IDs.

Other Information

No response

Acknowledgements

CDK version used

2.155.0

Environment details (OS name and version, etc.)

MacOS Ventura, M2 Chip

pahud commented 2 months ago

Makes sense. We can consider to create a new static method for that. We welcome any PRs from the community.

jdebuseamazon commented 3 weeks ago

31958 adds some cross regional inference constructs that might be useful