Work inside your AWS Cloud9 or local environment.
aws configure
- In AWS Cloud9 configure the AWS CLI as follows.
- AWS Access Key ID: (Use default)
- AWS Secret Access Key: (Use default)
- Default region name [us-east-1]: us-east-1
- Default output format [json]: json
- In your local environment configure the AWS CLI with your own IAM credentials.
Update Node.js to the minimal version of 8.
nvm i v8
Install Serverless CLI tool https://serverless.com/framework/docs/providers/aws/guide/installation/
npm install -g serverless
serverless create --template aws-python --path serverless-textract
cd serverless-textract
echo boto3==1.9.157 > requirements.txt
pip install -r requirements.txt -t .
Replace your handler.py with the contents of the file handler.py.
Replace your serverless.yml with the contents of the file serverless.yml, in line 17 is specified the bucket name to be created, change the value for bucketName with a unique name (you can use your name or nickname).
serverless deploy
Go to the Amazon S3 Console https://s3.console.aws.amazon.com/, go inside your bucket created and upload a png or jpg document, few seconds later a json file with the result will be created.
Sample images: book.zip