I'm currently navigating the learning curve of using Pulumi for deploying infrastructure as code, and I'm facing a specific challenge. My goal is to integrate Pulumi into an AWS Lambda function, where the Lambda will be responsible for deploying additional infrastructure, such as Lambdas and SNS subscriptions.
I've scoured the internet for examples or documentation on this particular use case, but unfortunately, I haven't been able to find anything that directly addresses it.
Has anyone successfully implemented Pulumi within an AWS Lambda for infrastructure deployment? If so, could you provide a concise example or point me in the right direction? Any help or guidance would be greatly appreciated.
Thank you!
It depends what kind of lambda function you’re using.
Pulumi requires the CLI to be available to be able to run updates, no matter whether you’re using the automation api or a standard Pulumi program.
This means that if you’re running a zip file-based lambda function you won’t be able to run the CLI because it’s not possible with this kind of function.
However, if you add the Pulumi CLI to a container and use this in a container-based lambda function you can do it.
The caveat I always give here is that since you’re charged by the length of time the function takes to run, you might not want to use this method to deploy something that takes a while, such as an RDS instance.