https://pulumi.com logo
#aws
Title
# aws
q

quiet-football-73782

01/31/2024, 7:20 PM
I am using pulumi to set up a function in lambda.
Copy code
hello_world_lambda = aws.lambda_.Function(
    'hello-world-lambda',
    role=lambda_role.arn,
    runtime='python3.9',
    handler='lambda_function.handler', 
    code=pulumi.AssetArchive({
        '.': pulumi.FileArchive(f'./lambda/test/'),
    }),
    timeout=60
)
This succesfully uploads the content of my test dir to lambda. My function in lambda needs to utilize pandas (which is not native to lambda). If I install pandas directly in my test dir, it will fail when I try to import it in my lambda function. If instead I set a venv within my test dir, it will not be uploaded for whatever reason. What is the proper way to set up extra dependencies (in this case pandas) with pulumi in lambda?
Was able to solve it by using aws lambda layers - there is a default layer with pandas package. Importing it through pulumi is very straightforward, just add an argument
Copy code
layers=[layer.arn]