Open jfarr opened 2 years ago
FYI after trying many different configurations the only way I could get this to work was as a Lambda container image. Here's the Dockerfile I used for reference:
FROM lambci/lambda:build-python3.6 AS lambda-build
RUN pip install invokust --target /temp/python-packages
COPY lambda_locust.py locustfile.py /temp/python-packages/
FROM public.ecr.aws/lambda/python:3.6
COPY --from=lambda-build /temp/python-packages "${LAMBDA_TASK_ROOT}"
CMD [ "lambda_locust.handler" ]
Then you have push the image to an ECR repository and create the lambda function with:
aws lambda create-function\
--function-name lambda_locust\
--package-type Image\
--code ImageUri=9999999999.dkr.ecr.region-name.amazonaws.com/lambda_locust:latest\
--role arn:aws:iam::9999999999:role/lambda_basic_execution\
--timeout 300
the only way I could get this to work was as a Lambda container image
That's annoying!
Any pointers what I might be doing wrong?
I don't have a solution but surely it's just a question of installing the pip packages using the correct docker image. Did you try using public.ecr.aws/lambda/python:3.6
? I mean like:
docker run -it --volume=$PWD:/temp public.ecr.aws/lambda/python:3.6 bash -c "pip install /temp --target=/temp/python-packages"
I don't have a solution but surely it's just a question of installing the pip packages using the correct docker image. Did you try using
public.ecr.aws/lambda/python:3.6
? I mean like:docker run -it --volume=$PWD:/temp public.ecr.aws/lambda/python:3.6 bash -c "pip install /temp --target=/temp/python-packages"
That image doesn't have the necessary toolchain.
jfarr1@LMTC-JFARR invokust % docker run -it --volume=$PWD:/temp --entrypoint="" public.ecr.aws/lambda/python:3.6 bash -c "pip install /temp --target=/temp/python-packages" Unable to find image 'public.ecr.aws/lambda/python:3.6' locally 3.6: Pulling from lambda/python [...] generating cffi module 'build/temp.linux-x86_64-3.6/gevent.libuv._corecffi.c' creating build/temp.linux-x86_64-3.6 Running '(cd "/tmp/pip-install-mj8r3csr/gevent/deps/libev" && sh ./configure -C > configure-output.txt )' in /tmp/pip-install-mj8r3csr/gevent configure: error: in `/tmp/pip-install-mj8r3csr/gevent/deps/libev': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
What if you run the pip install
using the lambci/lambda:build-python3.6
image? i.e.
docker run -it --volume=$PWD:/temp lambci/lambda:build-python3.6 bash -c "pip install /temp --target=/temp/python-packages"
Hi, I followed the instructions under
Running Locust on AWS Lambda
but all I get is this error when I runinvokr.py
:Any pointers what I might be doing wrong? I'm building the Lambda package on MacOS Big Sur using these commands: