Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serverless-components/aws-lambda-layer
The easiest way to develop & deploy AWS Lambda Layers using Serverless Components
https://github.com/serverless-components/aws-lambda-layer
aws aws-lambda aws-lambda-layer serverless serverless-components
Last synced: 10 days ago
JSON representation
The easiest way to develop & deploy AWS Lambda Layers using Serverless Components
- Host: GitHub
- URL: https://github.com/serverless-components/aws-lambda-layer
- Owner: serverless-components
- License: apache-2.0
- Created: 2019-03-19T14:22:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-23T11:45:10.000Z (over 3 years ago)
- Last Synced: 2023-03-02T16:11:35.419Z (over 1 year ago)
- Topics: aws, aws-lambda, aws-lambda-layer, serverless, serverless-components
- Language: JavaScript
- Homepage: https://www.serverless.com
- Size: 206 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Serverless Components](https://s3.amazonaws.com/public.assets.serverless.com/images/readme_serverless_components.gif)](http://serverless.com)
**AWS Lambda Layer Component** ⎯⎯⎯ The easiest way to develop & deploy AWS Lambda Layers, powered by [Serverless Components](https://github.com/serverless/components/tree/cloud).
- [x] **Zero Configuration** - All we need is your code, then just deploy.
- [x] **Fast Deployments** - Watch for code changes and deploy in seconds.
- [x] **Team Collaboration** - Simply share layer arn and other outputs with your team.
- [x] **Easy Management** - Easily manage your layers with the Serverless Dashboard
1. [**Install**](#1-install)
2. [**Initialize**](#2-initialize)
3. [**Deploy**](#3-deploy)
4. [**Configure**](#4-configure)
5. [**Develop**](#5-develop)
6. [**Monitor**](#6-monitor)
7. [**Remove**](#7-remove)
### 1. Install
To get started with component, install the latest version of the Serverless Framework:
```
$ npm install -g serverless
```After installation, make sure you connect your AWS account by setting a provider in the org setting page on the [Serverless Dashboard](https://app.serverless.com).
### 2. Initialize
The easiest way to start using the `aws-lambda-layer` component is by initializing the `aws-lambda-layer-starter` template. Just run this command:
```
$ serverless init aws-lambda-layer-starter
$ cd aws-lambda-layer-starter
```### 3. Deploy
Once you have the directory set up, you're now ready to deploy. Just run the following command from within the directory containing the `serverless.yml` file:
```
$ serverless deploy
```Your first deployment might take a little while, but subsequent deployment would just take few seconds. For more information on what's going on during deployment, you could specify the `--debug` flag, which would view deployment logs in realtime:
```
$ serverless deploy --debug
```### 4. Configure
The `aws-lambda-layer` component is a zero configuration component, meaning that it'll work out of the box with no configuration and sane defaults. With that said, there are still some optional configuration that you can specify.
Here's a complete reference of the `serverless.yml` file for the `aws-lambda-layer` component:
```yml
component: aws-lambda-layer # (required) name of the component. In that case, it's aws-lambda-layer.
name: my-layer # (required) name of your instance/layer.
org: serverlessinc # (optional) serverless dashboard org. default is the first org you created during signup.
app: myApp # (optional) serverless dashboard app. default is the same as the name property.
stage: dev # (optional) serverless dashboard stage. default is dev.inputs:
src: ./src # (required) path to the source folder containing the layer logic.
runtimes: # (optional) runtimes that are compatible with this layer. default is an empty array.
- nodejs12.x
region: us-east-2 # (optional) aws region to deploy to. default is us-east-1.
```Once you've chosen your configuration, run `serverless deploy` again (or simply just `serverless`) to deploy your changes.
### 5. Develop
Now that you've got your basic layer up and running, it's time to develop that into a layer that you could actual use. Instead of having to run `serverless deploy` everytime you make changes you wanna test, you could enable dev mode, which allows the CLI to watch for changes in your source directory as you develop, and deploy instantly on save.
To enable dev mode, just run the following command:
```
$ serverless dev
```### 6. Monitor
Anytime you need to know more about your running `aws-lambda-layer` instance, you can run the following command to view the most critical info.
```
$ serverless info
```This is especially helpful when you want to know the outputs of your instances so that you can reference them in another instance. It also shows you the status of your instance, when it was last deployed, and how many times it was deployed. You will also see a url where you'll be able to view more info about your instance on the Serverless Dashboard.
To digg even deeper, you can pass the `--debug` flag to view the state of your component instance in case the deployment failed for any reason.
```
$ serverless info --debug
```
### 7. RemoveIf you wanna tear down your entire `aws-lambda-layer` infrastructure that was created during deployment, just run the following command in the directory containing the `serverless.yml` file.
```
$ serverless remove
```The `aws-lambda-layer` component will then use all the data it needs from the built-in state storage system to delete only the relavent cloud resources that it created. Just like deployment, you could also specify a `--debug` flag for realtime logs from the website component running in the cloud.
```
$ serverless remove --debug
```