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

AWS boto3 : UnknownServiceError: Unknown service: 'Bedrock' #3914

Closed
2 tasks
user-preethy opened this issue Oct 26, 2023 · 5 comments
Closed
2 tasks

AWS boto3 : UnknownServiceError: Unknown service: 'Bedrock' #3914

user-preethy opened this issue Oct 26, 2023 · 5 comments
Assignees
Labels
response-requested Waiting on additional information or feedback.

Comments

@user-preethy
Copy link

user-preethy commented Oct 26, 2023

Describe the feature

I am facing an issue with boto3 module in AWS. I am using boto3 module & running below code in python. Code execution is successful when running locally but fails with UnknownServiceError when executed in AWS Lambda.

bedrock = boto3.client(service_name='bedrock',region_name='us-east-1',endpoint_url='https://invoke-bedrock.us-east-1.amazonaws.com')

After a lot of research, I found that local boto3 version is 1.28.71 and AWS boto3 version is 1.26.90. I tried by adding latest boto3 as layer in lambda function, but its not working. Still showing old version.
Can anyone please help me with this?

Use Case

For using bedrock with lambda.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

Local boto3 version is 1.28.71 and AWS boto3 version is 1.26.90.

Environment details (OS name and version, etc.)

Windows 10

@user-preethy user-preethy added feature-request This issue requests a feature. needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2023
@tim-finnigan tim-finnigan self-assigned this Oct 26, 2023
@tim-finnigan
Copy link
Contributor

Hi @user-preethy thanks for reaching out. Here is a Knowledge Center article to help with troubleshooting this issue: https://repost.aws/knowledge-center/lambda-python-runtime-errors.

You mentioned that you already tried creating a Lambda layer, could you walks us through the steps that you took to do that?

The Bedrock service was introduced in Boto3 1.28.57 and Botocore 1.31.57, and the default Lambda runtimes for Python are currently boto3-1.26.90 botocore-1.29.90 for Python 3.7-3.10 and boto3-1.27.1 botocore-1.30.1 for Python 3.11.

You can confirm which versions your Lambda function is using by adding:

import boto3
import botocore
print(boto3.__version__)
print(botocore.__version__)

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. and removed feature-request This issue requests a feature. needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2023
@user-preethy
Copy link
Author

Hi @tim-finnigan thanks for the reply.
I created Lambda layer through console. First, created a folder 'boto3' in local and installed boto3(version 1.28.71) using pip command. Zipped folder and uploaded to S3 bucket. Then, created a layer 'boto3' with the object url from S3 and chose runtime python 3.7,3.8,3.9,3.10,3.11. Finally, added layer in the particular lambda function.Runtime of lambda function is python 3.9
I confirmed version of boto3 and botocore in lambda function. It is boto3-1.26.90 botocore-1.29.90.

@tim-finnigan
Copy link
Contributor

Hi @user-preethy thanks for following up. Can you confirm that your Lambda layer is attached here?

image

In the article linked earlier, I recommend following the steps under the section Manually create a Lambda layer that uses the latest Boto3 version which involves using the AWS CLI.

In the Lambda Developer Guide you can find more information on working with Lambda layers and packaging Python dependencies.

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. and removed response-requested Waiting on additional information or feedback. labels Oct 26, 2023
@user-preethy
Copy link
Author

Thanks @tim-finnigan Issue is resolved.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
response-requested Waiting on additional information or feedback.
Projects
None yet
Development

No branches or pull requests

2 participants