Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
nlp-cli
Advanced tools
Readme
Command line tool to locally run and deploy your node.js application to Amazon Lambda.
node-lambda run
npm install -g node-lambda
The node-lambda-template example app makes it easy to get up and running.
There are 4 available commands.
node-lambda setup
node-lambda run
node-lambda package
node-lambda deploy
Initializes the event.json
, context.json
, .env
files, and deploy.env
files. event.json
is where you mock your event. context.json
is where you can add additional mock data to the context passed to your lambda function. .env
is where you place your deployment configuration. deploy.env
has the same format as .env
, but is used for holding any environment/config variables that you need to be deployed with your code to Lambda but you don't want in version control (e.g. DB connection info).
$ node-lambda setup --help
Usage: run [options]
Options:
-h, --help output usage information
After running setup, it's a good idea to gitignore the generated event.json
and .env
files.
echo -e ".env\ndeploy.env\nevent.json" >> .gitignore
Runs your Amazon Lambda index.js file locally. Passes event.json
data to the Amazon Lambda event object.
$ node-lambda run --help
Usage: run [options]
Options:
-h, --help Output usage information
--handler [index.handler] Lambda Handler {index.handler}
-j, --eventFile [event.json] Event JSON File
-u, --runtime [nodejs4.3] Lambda Runtime {nodejs4.3, nodejs} - "nodejs4.3" is the current standard, "nodejs" is v0.10.36
-x, --contextFile [context.json] Context JSON file
Bundles your application into a local zip file.
$ node-lambda package --help
Usage: package [options]
Options:
-h, --help output usage information
-p, --packageDirectory [build] Local Package Directory
-n, --functionName [node-lambda] Lambda FunctionName
-e, --environment [staging] Choose environment {development, staging, production}
-f, --configFile [] Path to file holding secret environment variables (e.g. "deploy.env")
Bundles and deploys your application up to Amazon Lambda.
$ node-lambda deploy --help
Usage: deploy [options]
Options:
-h, --help output usage information
-e, --environment [staging] Choose environment {development, staging, production}
-a, --accessKey [your_key] AWS Access Key
-s, --secretKey [your_secret] AWS Secret Key
-k, --sessionToken [your_token] AWS Session Token
-r, --region [us-east-1] AWS Region(s)
-n, --functionName [node-lambda] Lambda FunctionName
--handler [index.handler] Lambda Handler {index.handler}
-o, --role [your_role] Amazon Role ARN
-m, --memorySize [128] Lambda Memory Size
-t, --timeout [3] Lambda Timeout
-d, --description [missing] Lambda Description
-u, --runtime [nodejs4.3] Lambda Runtime {nodejs4.3, nodejs} - "nodejs4.3" is the current standard, "nodejs" is v0.10.36
-p, --publish [false] This boolean parameter can be used to request AWS Lambda to create the Lambda function and publish a version as an atomic operation
-v, --version [custom-version] Lambda Version
-f, --configFile [] Path to file holding secret environment variables (e.g. "deploy.env")`
-b, --vpcSubnets [] VPC Subnet ID(s, comma separated list) for your Lambda Function, when using this, the below param is also required
-g, --vpcSecurityGroups [] VPC Security Group ID(s, comma separated list) for your Lambda Function, when using this, the above param is also required
AWS Lambda doesn't let you set environment variables for your function, but in many cases you will need to configure your function with secure values that you don't want to check into version control, for example a DB connection string or encryption key. Use the sample deploy.env
file in combination with the --configFile
flag to set values which will be prepended to your compiled Lambda function as process.env
environment variables before it gets uploaded to S3.
AWS Lambda now supports Node.js v4.3.2, and there have been some API changes for the new version. Most notably,
context.done()
, context.succeed()
, and context.fail()
are deprecated in favor of the Node convention of passing in
a callback function. These will still work for now for backward compatibility, but are no longer recommended.
v0.10.36 is still supported, and can be targeted by changing the AWS_RUNTIME
value to nodejs
in the .env
file.
When running node-lambda deploy
if you need to do some action after npm install --production
and before deploying to AWS Lambda (i.e. replace some modules with precompiled ones or download some libraries) you can create post_install.sh
script. If the file exists the script will be executed (and output shown after execution) if not it is skipped. Make sure that the script is executable.
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)npm install
npm test
FAQs
Command line tool for locally running and remotely deploying your node.js applications to Amazon Lambda.
The npm package nlp-cli receives a total of 3 weekly downloads. As such, nlp-cli popularity was classified as not popular.
We found that nlp-cli 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.