anthropic-sdk-python icon indicating copy to clipboard operation
anthropic-sdk-python copied to clipboard

Feature: Support for access aws bedrock through role arn directly and retrieve the AKSK from boto3.Session directly

Open richzw opened this issue 1 year ago • 0 comments

Currently, if we want to access the aws bedrock through role arn, we should

bedrock_role="arn:aws:iam::xxxx:role/bedrock-access-role" 
credentials = boto3.client('sts').assume_role(RoleArn=bedrock_role,RoleSessionName='assume-role')

client = AnthropicBedrock(aws_region="us-west-2", aws_access_key=credentials['Credentials']['AccessKeyId'], aws_secret_key=credentials['Credentials']['SecretAccessKey'])

Should we support access aws bedrock through role arn directly? such as

client = AnthropicBedrock(aws_region="us-west-2", aws_role_arn="arn:aws:iam::xxxx:role/bedrock-access-role")

Another feature is that we could get the AKSK and region from boto3.Session directly, and those data from the credential file under the default .aws folder.

c= boto3.Session()
cr=c.get_credentials().get_frozen_credentials()
cr.access_key
cr.secret_key
c.region_name

If one of them could be approved, May I push the related PR?

richzw avatar Jun 14 '24 13:06 richzw