# lambda-bundler

> Utility to deploy lambda functions to AWS from the command line

Latest version **1.1.1** (published 2017-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install lambda-bundler
pnpm add lambda-bundler
yarn add lambda-bundler
bun add lambda-bundler
```

Provides the command `lambda-bundler`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-05-31 |
| First published | 2016-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Leonard Martin |
| Maintainers | lennym |
| Keywords | serverless, aws, lambda, deploy |

## Links

- npm: https://www.npmjs.com/package/lambda-bundler
- npm.io page: https://npm.io/package/lambda-bundler

## Dependencies (9)

- [copy](https://npm.io/package/copy.md) ^0.3.0
- [env2](https://npm.io/package/env2.md) ^2.1.0
- [glob](https://npm.io/package/glob.md) ^7.0.5
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [ignore](https://npm.io/package/ignore.md) ^3.1.3
- [rimraf](https://npm.io/package/rimraf.md) ^2.5.4
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.7.21
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2017-05-31
- 1.1.0 — 2017-05-31
- 1.0.2 — 2017-01-10
- 1.0.1 — 2016-08-17
- 1.0.0 — 2016-08-17
- 0.2.2 — 2016-08-04
- 0.2.1 — 2016-08-04
- 0.2.0 — 2016-08-03
- 0.1.1 — 2016-08-02
- 0.1.0 — 2016-08-02
- 0.0.1 — 2016-08-01

## README

# lambda-bundler

Utility to deploy lambda functions to AWS from the command line.

## Usage

First, ensure your project's `main` module in question exports a lambda function. That is, your module looks something like:

```javascript
module.exports = function (event, context, callback) {
  /*...*/
}
```

And if you have not already, [ensure that your AWS credentials are correctly configured](#configuration).

Then you can simply run from your project root directory to deploy your lambda to AWS:

```shell
npm install -g lambda-bundler
lambda-bundler
```

Alternatively, install as a local dependency to your project and alias to an npm script:

```shell
npm install --save-dev lambda-bundler
```

And in your package.json add the following to your `"scripts"`:

```
"deploy": "lambda-bundler"
```

Then you can run:

```shell
npm run deploy
```

## Configuration

Configuration of AWS credentials is done via environment variables. The following environment variables are required as a minimum:

```
export AWS_ACCESS_KEY_ID=[redacted]
export AWS_SECRET_ACCESS_KEY=[redacted]
export AWS_IAM_ROLE=[redacted]
```

Additionally, the [region option](#region) can be configured with an environment variable of `AWS_REGION`.

You may wish to keep these in a `.env` file in your project (**which you should add to .gitignore and NOT check into source control**). If you wish to load environment variables from a `.env` file then these can be loaded automatically by running:

```shell
lamdbda-bundler --env .env
```

## Options

All options can be passed as command line flags or defined in a `lambda-bundler` section of your package.json.

### name

`String` - Defines the `FunctionName` of your lambda in AWS

Default: the name of your module as defined in package.json

### description

`String` - Defines the decription of your lambda in AWS

Default: the description of your module as defined in package.json

### files

`Array|String` - List of file names (or globs) to be uploaded to AWS as your lambda

Default: `['**/*.js']`

Note: `package.json` is *always* included in your bundle

### ignore

`Array|String` - List of file names (or globs) of files to be excluded from the bundle

Default: `[]`

Note: `node_modules` is *always* ignored

### ignoreFile

`String` - Path to an ignore file

Default: `'.lambdaignore'`

Note: Passing a value of `'git'` or `'npm'` will use `.gitignore` and `.npmignore` respectively.

### region

`String` - AWS region to load lambda into

Default: `process.env.AWS_REGION`

### role

`String` - AWS IAM role to use for created lambda

Default: `process.env.AWS_IAM_ROLE`

### envfile

`Boolean|String` - If set, writes the current set of environment variables to a file and includes it in the bundle. If A string is passed then this defines the filename environment variables will be written to.

Default: `false` - if set to a truthy, non-string then defaults to `'.env'`.

---
_Source: https://npm.io/package/lambda-bundler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
