anything-llm icon indicating copy to clipboard operation
anything-llm copied to clipboard

Add AWS credential profile support for AWS Bedrock

Open heiwais25 opened this issue 11 months ago • 0 comments

Pull Request Type

  • [x] ✨ feat
  • [ ] 🐛 fix
  • [ ] ♻️ refactor
  • [ ] 💄 style
  • [ ] 🔨 chore
  • [ ] 📝 docs

Relevant Issues

Resolves #2864

What is in this change?

Support using AWS Credentials profile to avoid passing the static AWS Access Key and Secret Key manually. It will also allow the easy integration with using IAM Role when the server is running on AWS EC2.

Additional Information

  • Lanchain Reference code: https://v03.api.js.langchain.com/classes/_langchain_aws.ChatBedrockConverse.html
  • https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html

Developer Validations

  • [x] I ran yarn lint from the root of the repo & committed changes
  • [ ] Relevant documentation has been updated → I'll work on this in separate PR since it can be larger change.
  • [x] I have tested my code functionality
  • [x] Docker build succeeds locally - Ran with each option (IAM, Session, and Profile)

Test Details

  1. Prepare AWS credentials by running aws configure
  2. Add the following configuration to the devcontainer.json.
{
  "mounts": [
    "source=${env:HOME}${env:USERPROFILE}/.aws,target=/root/.aws,type=bind"
  ],
  "remoteUser": "root",
}
  1. Run the server and check the Bedrock invocation with each option.

With the change,

  • IAM Selected iam-credentials

  • Profile Selected profile-credentials

heiwais25 avatar Jan 08 '25 05:01 heiwais25