This is a Serverless Framework plugin that helps bundling any stateless zipped library to the Lambda deployment artifact.
- Node 6.9 or later
- Serverless Framework 1.4.0 or later
-
Add these lines to your .gitignore file
.ephemeral node_modules -
Go to the root folder of your Serverless service and create a package.json with the following content:
{ "devDependencies": { "serverless-ephemeral": "git+https://git@github.com:Accenture/serverless-ephemeral.git" } } -
Run
npm install -
Add the plugin and exclussions to your
serverless.ymlfileplugins: - serverless-ephemeral package: exclude: - package.json - .ephemeral/** - node_modules/**
The configuration for the Ephemeral plugin is set inside the custom section of the serverless.yml file. In it, you can define the list of stateless libraries you wish to pull into the final Lambda artifact.
The stateless libraries MUST be zip files
custom:
ephemeral:
libraries:
- url: https://xxxxx.s3.amazonaws.com/tensorflow-1.0.0-cp27-cp27mu-linux_x86_64.zip
- url: https://xxxxx.s3.amazonaws.com/test-library.zip
forceDownload: true- The url is mandatory, since it is the location where your zipped library is found
- forceDownload is optional. When set to true, it will download the library only the first time, saving a local copy and reusing it every time the service is deployed
-
Deploy your service normally with the
serverless deploy(orsls deploy) command. If you use the-voption, Ephemeral will show more information about the process.sls deploy -v
Given the plugin bundles libraries, the final zipped asset size may increase considerable. Under slow connections, consider using the
AWS_CLIENT_TIMEOUTenvironment variable (see serverless/serverless#490 (comment))
During the deployment process, a .ephemeral directory will be created. The purpose of this directory is:
- Saving the downloaded library zip files inside the
.ephemeral/libfolder - Bundling the libraries and the Serverless Lambda function file(s) inside the
.ephemeral/pkgfolder
This plugin is created with Node and uses the Serverless Framework hooks to execute the necessary actions.
-
Clone this repository
git clone https://github.com/Accenture/serverless-ephemeral.git
-
Install the node dependencies
npm install
The plugin code uses the AirBnB ESLint rule set with some enhancements (see .eslintrc file). To run the linter:
npm run lintThe unit tests are coded with Ava and SinonJS. They can be found inside the spec folder. To run the tests:
npm testTo run tests on "watch" mode and add verbosity:
npm test -- --watch -v
This is a Serverless Framework plugin that helps bundling any stateless zipped library to the Lambda deployment artifact.
- Node 6.9 or later
-
Add these lines to your .gitignore file
.ephemeral node_modules -
Go to the root folder of your Serverless service and create a package.json with the following content:
{ "devDependencies": { "serverless-ephemeral": "git+https://git@github.com:Accenture/serverless-ephemeral.git" } } -
Run
npm install -
Add the plugin and exclussions to your
serverless.ymlfileplugins: - serverless-ephemeral package: exclude: - package.json - .ephemeral/** - node_modules/**
The configuration for the Ephemeral plugin is set inside the custom section of the serverless.yml file. In it, you can define the list of stateless libraries you wish to pull into the final Lambda artifact.
The stateless libraries MUST be zip files
custom:
ephemeral:
libraries:
- url: https://domain.com/library-A.zip
- url: https://domain.com/library-B.zip
forceDownload: true
- The url is mandatory, since it is the location where your zipped library is found
- forceDownload is optional. When set to true, it will download the library only the first time, saving a local copy and reusing it every time the service is deployed
-
Deploy your service normally with the
serverless deploy(orsls deploy) command. If you use the-voption, Ephemeral will show more information about the process.sls deploy -v
Given the plugin bundles libraries, the final zipped asset size may increase considerable. Under slow connections, consider using the
AWS_CLIENT_TIMEOUTenvironment variable (see serverless/serverless#490 (comment))
During the deployment process, a .ephemeral directory will be created. The purpose of this directory is:
- Saving the downloaded library zip files inside the
.ephemeral/libfolder - Bundling the libraries and the Serverless Lambda function file(s) inside the
.ephemeral/pkgfolder
This plugin is created with Node and uses the Serverless Framework hooks to execute the necessary actions.
-
Clone this repository
git clone https://github.com/Accenture/serverless-ephemeral.git
-
Install the node dependencies
npm install
The plugin code uses the AirBnB ESLint rule set with some enhancements (see .eslintrc file). To run the linter:
npm run lintThe unit tests are coded with Ava and SinonJS. They can be found inside the spec folder. To run the tests:
npm testTo run tests on "watch" mode and add verbosity:
npm test -- --watch -v