Runs pylibdmtx on AWS Lambda, using AWS Serverless Application Model.
The py_dmtx_layer contains the binaries for libdmtx and the necessary binutils binaries to load the shared library on python
To generate the necessary binaries run download_binaries.sh. This script will start a docker container with amazonlinux:2, then it will compile libdmtx
and download the necessary binaries for ld & objdump
, those binaries will be copied to py_dmtx_layer/lib and py_dmtx_layer/bin.
ℹ️ Make sure you have python3.8 installed! |
---|
With the binaries in place you can build the project and test locally
$ sam build
$ sam local invoke # the expected result from the lambda below
{"statusCode": 200, "body": "[{\"content\": \"Stegosaurus\", \"rect\": [5, 6, 96, 95]}, {\"content\": \"Plesiosaurus\", \"rect\": [298, 6, 95, 95]}]"}
Now you can create your stack on AWS:
$ sam deploy --guided
CloudFormation outputs from deployed stack
-------------------------------------------------------------------
Outputs
-------------------------------------------------------------------
Key LambdaName
Description -
Value mystack-DecoderFunction-93934828asdj
-------------------------------------------------------------------
This will create a lambda function which name is represented on the output above, you can navigate to your AWS Console and test your function.