Copy Binaries In Lambda /tmp Folder While Deploying The Lambda

85 views Asked by At

I am trying to run a headless Chrome service on lambda using NodeJS. My code works fine but it is complaining about the chrome binaries as the lambda does not have them.

If I try to ship the binaries in the zip package,the maximum zip size for lambda reaches (which I think is 250MB with a hard limit)

I read the documentation and a few articles and I got to know that we can make use of the ephemeral storage where we can store additional files in /tmp/ directory.

My problem is - How to copy the chrome binaries in the /tmp/ folder WHILE DEPLOYING the lambda (so it becomes a one-time process)

I don't want to execute this process during the lambda execution as it will become an unnecessary overhead.

I have heard of using a helper lambda as a resource to the main lambda function but I am not sure if it is possible.

I tried a serverless configuration for the same as follows but it doesn't work -

resources:
    CopyChromeBinaries:
        Type: Custom::CopyChromeBinaries
        Properties:
            ServiceToken: arn:aws:lambda:region:ACCOUNT_ID:function:CopyChromeBinaries

Please let me know if I have missed anything or if more information is required

0

There are 0 answers