Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing Amazon Bedrock Models Across Regions #7965

Closed
markramrattan opened this issue Sep 12, 2024 · 7 comments
Closed

Accessing Amazon Bedrock Models Across Regions #7965

markramrattan opened this issue Sep 12, 2024 · 7 comments

Comments

@markramrattan
Copy link

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.

@ykethan
Copy link
Member

ykethan commented Sep 13, 2024

Hey,👋 thanks for raising this! I'm going to transfer this over to our documentation repository for content and documentation updates.

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Sep 13, 2024
@ykethan
Copy link
Member

ykethan commented Sep 13, 2024

@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
Copy link
Author

@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",
});
Screenshot 2024-09-13 at 21 42 07 Screenshot 2024-09-13 at 21 49 23

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.

@ykethan
Copy link
Member

ykethan commented Sep 18, 2024

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.

@markramrattan
Copy link
Author

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/

@pierresisson
Copy link

You should add Inference example in the doc

@ykethan
Copy link
Member

ykethan commented Nov 27, 2024

@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 #8121.
refer to the comment #8121 (comment) providing an example.

closing this issue, do open a issue on Amplify backend repository if you are facing any issues

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants