https://pulumi.com logo
#python
Title
# python
w

worried-plastic-45846

04/28/2020, 6:20 PM
Hello, When creating a lambda from a local zip file, I can pass the hash of my file in the parameter
source_code_hash
. This way, the lambda is updated when my zip file changed. When creating a lambda from a zip hosted on an S3 Bucket, how can I calculate the hash of the remote file?
c

chilly-hairdresser-56259

04/30/2020, 1:57 PM
One option that I have used in the past. Calculate the local hash of either the .zip or the actual code. Then create a new object in Pulumi adding additional metadata of say MD5 or something. Then you can add logic to check local hash to remote hash if hashes do not match, then proceed with updating the lambda function.
An idea that I have been throwing around right now is to add a Lambda Tag, such as hash. Then check the tag and evaluate the differences. I beleive this is what source_code_hash is supposed to do, but I have not found out a way for source_code_hash to actually store my value that I calculated. I might be doing it wrong too.