# @serverless/aws-lambda-layer

> Easily provision Layers for AWS Lambda using [Serverless Components](https://github.com/serverless/components).

Latest version **1.0.0** (published 2019-07-17) · Apache license · 0 weekly downloads

## Install

```sh
npm install @serverless/aws-lambda-layer
pnpm add @serverless/aws-lambda-layer
yarn add @serverless/aws-lambda-layer
bun add @serverless/aws-lambda-layer
```

## 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.0.0 |
| Published | 2019-07-17 |
| First published | 2019-03-21 |
| Weekly downloads | 0 |
| License | Apache |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 26.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Serverless, Inc. |
| Maintainers | ac360, aj.stuyvenberg, dschep, eahefnawy, pmuens |

## Links

- npm: https://www.npmjs.com/package/@serverless/aws-lambda-layer
- npm.io page: https://npm.io/package/@serverless/aws-lambda-layer

## Dependencies (7)

- [ramda](https://npm.io/package/ramda.md) ^0.26.1
- [globby](https://npm.io/package/globby.md) ^9.2.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.387.0
- [archiver](https://npm.io/package/archiver.md) ^3.0.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1
- [@serverless/core](https://npm.io/package/@serverless/core.md) ^1.0.0
- [@serverless/aws-s3](https://npm.io/package/@serverless/aws-s3.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2019-07-17
- 0.3.4 — 2019-07-05
- 0.3.3 — 2019-07-05
- 0.3.2 — 2019-06-18
- 0.3.1 — 2019-06-17
- 0.3.0 — 2019-06-13
- 0.2.0 — 2019-06-05
- 0.1.2 — 2019-03-27
- 0.1.1 — 2019-03-26
- 0.1.0 — 2019-03-21

## README

# aws-lambda-layer

Easily provision Layers for AWS Lambda using [Serverless Components](https://github.com/serverless/components).

&nbsp;

1. [Install](#1-install)
2. [Create](#2-create)
3. [Configure](#3-configure)
4. [Deploy](#4-deploy)

&nbsp;


### 1. Install

```console
$ npm install -g @serverless/components
```

### 2. Create


```console
$ mkdir my-layer && cd my-layer
```

in the case of a nodejs layer, the directory should look something like this:


```
|- code
  |- index.js     # the root of your library
  |- package.json # the main property should point to index.js in this example
|- serverless.yml
|- .env           # your development AWS api keys
|- .env.prod      # your production AWS api keys
```

the `.env` files are not required if you have the aws keys set globally and you want to use a single stage, but they should look like this.

```
AWS_ACCESS_KEY_ID=XXX
AWS_SECRET_ACCESS_KEY=XXX
```


### 3. Configure

```yml
# serverless.yml

name: my-layer
stage: dev

myLayer:
  component: "@serverless/aws-lambda-layer"
  inputs:
    name: my-layer
    description: My Serverless Layer
    code: ./code
    regoin: us-east-1
    runtimes: [ 'nodejs8.10' ] # the default is undefined (aka. all runtimes supported)

    # a path prefix to all the files that would be included in the package
    # this example would package a valid node dependency
    # since this is the path expected by aws
    prefix: nodejs/node_modules

    # if you'd like to include any files outside the codebase
    include:
      - ../external/file.js 

    # specifying an existing deployment bucket would optimise deployment speed
    # by using accelerated multipart uploads
    bucket: my-deployment-bucket
```

### 4. Deploy

```console
layer (master)$ components

  myLayer › outputs:
  name:  'my-layer'
  description:  'My Serverless Layer'
  arn:  'arn:aws:lambda:us-east-1:552760238299:layer:my-layer:1'


  29s › dev › my-layer › done

layer (master)$

```
For a real world example of how this component could be used, [take a look at how the aws-lambda component is using it](https://github.com/serverless-components/aws-lambda/blob/master/serverless.js#L64-L77).

&nbsp;

### New to Components?

Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information.

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