Skip to content

AWS s3 sync for lambda layers #7516

Closed

Description

@dazza-codes

Feature Proposal

Description

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.

Activity

  1. medikoo commented on Apr 21, 2020

    @medikoo
    Contributor

    @dazza-codes that's great idea! We're open for PR that improves our internals with it.

  2. exoego commented on Apr 21, 2020

    @exoego
    Contributor

    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?

  3. dazza-codes commented on May 2, 2020

    @dazza-codes
    Author

    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.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions