Accessing Amazon Bedrock Models Across Regions
Environment information
System:
OS: macOS 11.7.10
CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Memory: 1.14 GB / 16.00 GB
Shell: /bin/zsh
Binaries:
Node: 22.3.0 - ~/.nvm/versions/node/v22.3.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 10.8.3 - ~/.nvm/versions/node/v22.3.0/bin/npm
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.3.0
@aws-amplify/backend: 1.2.1
@aws-amplify/backend-auth: 1.1.3
@aws-amplify/backend-cli: 1.2.5
@aws-amplify/backend-data: 1.1.3
@aws-amplify/backend-deployer: 1.1.0
@aws-amplify/backend-function: 1.4.0
@aws-amplify/backend-output-schemas: 1.2.0
@aws-amplify/backend-output-storage: 1.1.1
@aws-amplify/backend-secret: 1.1.0
@aws-amplify/backend-storage: 1.1.2
@aws-amplify/cli-core: 1.1.2
@aws-amplify/client-config: 1.3.0
@aws-amplify/deployed-backend-client: 1.4.0
@aws-amplify/form-generator: 1.0.1
@aws-amplify/model-generator: 1.0.5
@aws-amplify/platform-core: 1.1.0
@aws-amplify/plugin-types: 1.2.1
@aws-amplify/sandbox: 1.2.0
@aws-amplify/schema-generator: 1.2.1
aws-amplify: 6.6.0
aws-cdk: Not Found
aws-cdk-lib: 2.156.0
typescript: 5.5.4
npm warn exec The following package was not found and will be installed: [email protected]
AWS environment variables:
AWS_STS_REGIONAL_ENDPOINTS = regional
AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables
Describe the feature
I would like to access Amazon Bedrock Gen A.I. models across regions using Amplify Gen 2.
My project is located in eu-west-1. There are only 12 models available in eu-west-1. For context there are 34 Models available in us-east-1 (where all the magic happens)
Use case
My current application is deployed in eu-west-1(Ireland). However the models i'd like to use are available in us-east-1(N. Virginia).
I can't access models like Stability A.I. - SDXL 1.0 in eu-west-1. I'd like to provide users with better image generation (within my eu-west-1 project).
The docs show this guide: https://docs.amplify.aws/nextjs/build-a-backend/data/custom-business-logic/connect-bedrock/ If your project is located not in us-east-1 it fails to use bedrock models cross regions. Would be good to have this cross region feature in AWS Amplify Gen2 with updated docs that show how to integrate cross-region inference.
Hey,👋 thanks for raising this! I'm going to transfer this over to our documentation repository for content and documentation updates.
@markramrattan you should be able to switch the region on the bedrock client to call a model in a different region.
const client = new BedrockRuntimeClient({
region: "us-east-1",
});
@markramrattan you should be able to switch the region on the bedrock client to call a model in a different region.
const client = new BedrockRuntimeClient({ region: "us-east-1", });
I've added the region now via the bedrock client. Though the lambda function generated is in eu-west-1 (as the project is located there) and i'm getting the same errors. Will try some more debugging tomorrow, any other ideas on how to get it to work is appreciated.
Hey @markramrattan, the issue doesnt appear to be a region issue as you would receive a permissions error. The error seems to be from the code in the handler I would suggest adding a console logs and verifying the cloudwatch logs to verify if the logs are being printed.
Hey @markramrattan, the issue doesnt appear to be a region issue as you would receive a permissions error. The error seems to be from the code in the handler I would suggest adding a console logs and verifying the cloudwatch logs to verify if the logs are being printed.
Hey, i'll try that, though i'm using / following the same code from the guide: https://docs.amplify.aws/nextjs/build-a-backend/data/custom-business-logic/connect-bedrock/
You should add Inference example in the doc
@markramrattan Amplify AI kit has been recently released providing support your AI use cases: https://docs.amplify.aws/react/ai/
@pierresisson the cross region inference example is currently being tracked on https://github.com/aws-amplify/docs/issues/8121. refer to the comment https://github.com/aws-amplify/docs/issues/8121#issuecomment-2494375015 providing an example.
closing this issue, do open a issue on Amplify backend repository if you are facing any issues