-
Install awscli and configure it https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
-
Install the Python requirements into the packages directory (for opencv, numpy etc.)
python3.13 -m pip install -t ./packages/ -r requirements.txt
- Create the deployment package including both, dependencies and the lambda code
(cd packages && zip -r ../lambda.zip .) && zip -g lambda.zip lambda_function.py
- Upload the Lambda code to S3
aws s3 cp lambda.zip s3://xray-image-processing/image-processing-lambda-code/
- Update the Lambda function to use the uploaded code
aws lambda update-function-code \
--function-name xray-image-processing \
--s3-bucket xray-image-processing \
--s3-key lambda.zip
- Since I don't have access to create IAM roles (for Lambda execution), I used an existing role (Role name: sironaPanProcessing-role-kmm8sby4) in the Lambda function.
- Increased the timeout to 10 seconds.
- Generated a non-authenticated function url and added custom authentication through bearer token.
- Generated an auth_token and set it in the environment variables (the same token needs to be passed when sending requests to the Lambda function)