![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
aws-lambda-deployer
Advanced tools
Facilitates deploying multiple Node.js-based AWS Lambda functions to multiple environments.
Facilitates deploying multiple Node.js-based AWS Lambda functions to multiple environments.
For each of your functions, this module runs npm install --production
(using npm 2), creates a zip file, and deploys it to one or more environments.
Environments are currently identified by prefixing the function name with the
environment name.
import AwsLambdaDeployer from 'aws-lambda-deployer'
const functionNames = ['lambda-one', 'lambda-two']
const options = {
environments: [],
prefix: '',
region: 'us-east-1',
handler: 'index.handler',
role: null,
functionDirTemplate: '<%= functionName %>',
metaPathTemplate: '<%= functionName %>/meta.json',
descriptionTemplate: 'Deployed on <%= new Date().toUTCString() %>',
concurrency: 3
}
const deployer = new AwsLambdaDeployer(functionNames, options)
deployer.run()
.then(() => console.info('Deployment completed'))
.catch((error) => console.info('Deployment failed:', error))
For each function that you wish to deploy, you need to provide a directory containing at least the following files:
index.js
(can be overridden using the handler
option)package.json
meta.json
The meta.json
file configures the function's timeout
(in seconds) and
memory
allocation in (megabytes):
{
"timeout": 3,
"memory": 256
}
Creates a new deployer.
Performs deployment. Installs, zips, and uploads each function. Returns a promise that gets fulfilled when all functions have been deployed.
The default values for all options are shown in the example above.
Note that all options currently apply to all functions, meaning you cannot (yet) override them on a per-function basis.
An array of environment names. For example, ['dev', 'prod']
.
The environment names are used to construct the name of the function on AWS
Lambda, by prefixing the original function name with the environment name
followed by a hyphen. For example, for function-one
, the Lambda function in
the dev
environment would be named dev-function-one
.
The string value with which to prefix each function name.
You'll most likely want to use this option to identify the app or service
encompassing your Lambdas. Combined with environments
, it lets you assign
Lambda names such as myapp-dev-lambda-one
. In this example, prefix
would be
myapp-
(including the hyphen).
The AWS region in which the functions should be deployed.
The entry point of the functions. The default value index.handler
means that
each function's index.js
module exports a handler
function.
The ARN of the role under which to run the functions.
By default, this module assumes that the current working directory contains a
subdirectory per function. You can override this by passing in a template string
containing the functionName
.
Similar to the path to the function directory, you can override the path to each
function's meta.json
file using this option.
By default, each function's description will be updated with the time of
deployment. You can use the descriptionTemplate
option to have the description
include a version string, for example.
The number of functions to package or deploy simultaneously.
Rather than just awaiting the promise, you'll probably want to track progress. A deployer exposes a number of events for this purpose. Here's a boilerplate implementation of a verbose logger:
deployer.on('willPackageFunctions', ({functionNames}) =>
console.info('Packaging', functionNames.length, 'function(s) ...'))
deployer.on('didPackageFunctions', ({functionNames}) =>
console.info('Packaged', functionNames.length, 'function(s)'))
deployer.on('willPackageFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Packaging function', functionName, '...'))
deployer.on('didPackageFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Packaged function', functionName))
deployer.on('willInstallFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Installing function', functionName, 'to', functionDir, '...'))
deployer.on('didInstallFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Installed function', functionName))
deployer.on('willZipFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Zipping function', functionName, 'to', zipFilePath, '...'))
deployer.on('didZipFunction', ({functionName, functionDir, zipFilePath, metaFilePath}) =>
console.info('Zipped function', functionName))
deployer.on('willDeployToEnvironments', ({environmentNames}) =>
console.info('Deploying to', environmentNames.length, 'environment(s) ...'))
deployer.on('didDeployToEnvironments', ({environmentNames}) =>
console.info('Deployed to', environmentNames.length, 'environment(s)'))
deployer.on('willDeployFunctions', ({environmentName, functionNames}) =>
console.info('Deploying', functionNames.length, 'function(s) to environment', environmentName, '...'))
deployer.on('didDeployFunctions', ({environmentName, functionNames}) =>
console.info('Deployed', functionNames.length, 'function(s) to environment', environmentName))
deployer.on('willDeployFunction', ({environmentName, functionName, remoteFunctionName, zipFilePath, zipFileSize}) =>
console.info('Deploying function', functionName, 'to environment', environmentName, 'as', remoteFunctionName + ': uploading', zipFileSize, 'bytes ...'))
deployer.on('didDeployFunction', ({environmentName, functionName, remoteFunctionName, zipFilePath, zipFileSize}) =>
console.info('Deployed function', functionName, 'to environment', environmentName, 'as', remoteFunctionName))
MIT
FAQs
Facilitates deploying multiple Node.js-based AWS Lambda functions to multiple environments.
The npm package aws-lambda-deployer receives a total of 4 weekly downloads. As such, aws-lambda-deployer popularity was classified as not popular.
We found that aws-lambda-deployer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.