You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there are no updates to the lambda layer package (.zip file), do not upload it for every deployment. Issue an s3-object-head request to get back some information about the existing lambda layer on s3 and compare it with the local filesystem resource. When it's clear that the s3 object has the same content size (or md5) as the local filesystem resource, skip the upload.
Reacted by TATSUNO “Taz” Yasuhiro, Jonathan Abila, Mariusz Nowak and Takahiro Horike
I think it i requires extra steps before head-objecting the zip file of previously uploaded layer, because object name contains timestamp and we don't know the timestamp.
It requires to know s3 key (the path to layer zip).
I am considering to fetch CloudFormation stack to retrieve the precious s3 key.
Any ideas?
It seems like serverless-plugins uses a local cached archive of layers to detect local changes. A .serverless/layer_cache.json could simply keep track of .zip file names and their md5 or similar hash fingerprints. If there are no local-file-system changes, then don't upload the layer again. (It doesn't solve the s3-consistency problem, when a team are all pushing to the same deployment target that might be sharing layers on s3; haven't really thought that through entirely.).
Activity
medikoo commentedon Apr 21, 2020
@dazza-codes that's great idea! We're open for PR that improves our internals with it.
exoego commentedon Apr 21, 2020
I think it i requires extra steps before
head-objecting the zip file of previously uploaded layer, because object name contains timestamp and we don't know the timestamp.It requires to know s3 key (the path to layer zip).
I am considering to fetch CloudFormation stack to retrieve the precious s3 key.
Any ideas?
dazza-codes commentedon May 2, 2020
It seems like serverless-plugins uses a local cached archive of layers to detect local changes. A
.serverless/layer_cache.jsoncould simply keep track of .zip file names and their md5 or similar hash fingerprints. If there are no local-file-system changes, then don't upload the layer again. (It doesn't solve the s3-consistency problem, when a team are all pushing to the same deployment target that might be sharing layers on s3; haven't really thought that through entirely.).