Boto 3 textract Unkown Service

0

Hello,

I tried launching a Lambda function in us-east-2 utilizing the textract boto3 client and got this error;

module initialization error: Unknown service: 'textract'. Valid service names are:...

My function followed the documentation;

import boto3

client = boto3.client('textract')

Any help is greatly appreciated!

abirone
질문됨 5년 전298회 조회
1개 답변
0
수락된 답변

You can use following steps to add current version of AWS SDK to your Lambda function that supports Amazon Textract. This is also a common best practice when deploying Lambda functions in production is to package dependencies with your functions.

1. Create package for Lambda Layer
pip install boto3 --target python/.
zip boto3-layer.zip -r python/

2. Create Lambda Layer

  • In AWS Console go to Lambda
  • Click on Layers and Create Layer
  • Name: Boto3
  • Upload boto3-layer.zip file you just created.
  • Compatible runtimes: Python3.6 and Python 3.7
  • Click Create

3. Add Lambda Layer to Lambda function
In your Lambda function, click on “Layers”

  • Under Layers, click on “Add a layer”
  • Under Compatible layers: select the layer and version you just created and click Add.
  • Click Save to save changes to Lambda function.

You should now be able to use Amazon Textract in your Lambda function.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠