Are there any aws lambda examples that are a littl...
# python
Are there any aws lambda examples that are a little more than hello world? What if your lambda function has dependencies? Currently we have a pipeline that builds deployable versioned artifacts that can be deployed with cloudformation. The pipeline handles doing pip installs for any dependencies.
You would need to either keep doing those
pip installs
from your CI environment, or else automatically invoke them from within your Pulumi program. This example is JavaScript and Azure deploying a .NET Function - but highlights some of the patterns that are likely to apply here:
I'm not familiar with azure, but after looking at that example, the overall pattern is 1) convert the app code into a deployable artifact 2) run pulumi to update infra and use that new artifact Ideally that deployable artifact would be built deterministically and not reinvoke the update on a consecutive runs...
That's right. And this example is the first of the two options I refer to above. The second would be to script the
pip install
into your pulumi program instead of depending on some external build in your CI environment. Certainly if your build is not deterministic, this approach will lead to churn of deployed artifacts. There are more complex options you could consider even if you do have a non-deterministic build to only trigger rebuild of the artifact on changes to input sources - but that would be more involved.
Do you know off hand how pulumi decides whether an artifact has changed? Is it just some hashing of the file?
Yes -
and related asset resources will hash the contents and use that to decide whether to report a change that needs to be flowed into dependencies.
ok so avoid zip compression then...
thanks for the info
I've written a few zippackers for zipapp purposes, which has very similar requirements to lambda. Using one of these with
or a modified version with
should work. (Unfortunately, I'm a pulumi newbie, so I have no idea how to integrate a build process into pulumi, or even if you should)