This message was deleted.
# automation-api
s
This message was deleted.
b
Where are you running Pulumi from in the container file system. I think it needs to be from
/tmp
because that’s the only writable location, plus it’s not available until after the lambda container has started so you’ll need to copy the pulumi binaries there (and make sure the correct env vars are pointing there too)
It’s great that you’re trying this, but in my experience Pulumi can take a while to run (especially if you’re doing stuff with databases or clusters etc) so could start to be expensive. My advice would be to run this in fargate or similar (if you’re trying to go down the serverless option) and maybe kick off the task from a lambda (if you’re trying to trigger it with events)
t
I'm running it from
${LAMBDA_TASK_ROOT}
specified on Dockerfile, which is the official AWS dockerfile
Just in case :
Copy code
FROM public.ecr.aws/lambda/python:3.8

# Install the function's dependencies using file requirements.txt
# from your project folder.
RUN yum install -y tar gzip && \
    yum clean all

COPY requirements.txt pulumi-v3.44.2-linux-x64.tar ./
RUN  pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
RUN  tar -xvf ./pulumi-v3.44.2-linux-x64.tar --strip-components=1 -C /usr/local/bin
     

# Copy function code
COPY lambda_function.py ${LAMBDA_TASK_ROOT}

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "lambda_function.lambda_handler" ]
👀 1
b
Your Pulumi program can run from the
${LAMBDA_TASK_ROOT}
but you’ll still need the Pulumi CLI in there
t
Pulumi CLI is on my $PATH, but I'll try to run it from /tmp
b
Also your
$PULUMI_HOME
needs to be there as well (as we explicitly write to that folder)
t
I've tested to set
PULUMI_HOME
to
/tmp
, but still aws lambda failed without explicit error (I've check and pulumi files are well created in /tmp). Is there a way to activate debug mode (like
logger.setLevel(logging.DEBUG)
)