Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sapessi/serverless-sam
Serverless framework plugin to export AWS SAM templates for a service
https://github.com/sapessi/serverless-sam
aws aws-apigateway aws-lambda aws-sam lambda nodejs plugin serverless serverless-framework
Last synced: 5 days ago
JSON representation
Serverless framework plugin to export AWS SAM templates for a service
- Host: GitHub
- URL: https://github.com/sapessi/serverless-sam
- Owner: sapessi
- License: apache-2.0
- Created: 2017-05-05T16:56:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T22:05:24.000Z (over 3 years ago)
- Last Synced: 2024-12-16T06:06:43.270Z (12 days ago)
- Topics: aws, aws-apigateway, aws-lambda, aws-sam, lambda, nodejs, plugin, serverless, serverless-framework
- Language: JavaScript
- Size: 44.9 KB
- Stars: 152
- Watchers: 9
- Forks: 26
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless SAM [![Build Status](https://travis-ci.org/SAPessi/serverless-sam.svg?branch=master)](https://travis-ci.org/SAPessi/serverless-sam)
Serverless-sam is a plugin for the [Serverless framework](https://serverless.com) that makes it easy to create [Serverless Application Model (SAM)](https://github.com/awslabs/serverless-application-model) templates from an application. The plugin adds the `sam` command to the serverless cli.# Installation
From your Serverless application directory, use `npm` to install the plugin:```
$ npm install --save-dev serverless-sam
```Once you have installed the plugin, add it to your `serverless.yml` file in the `plugins` sections.
```yaml
service: my-serverless-serviceplugins:
- serverless-samframeworkVersion: ">=1.1.0 <2.0.0"
...
```# Usage
Use the `sam export` command to generate a SAM definition from your service. Use the `--output` or `-o` option to set the name for the SAM template file.```
$ serverless sam export --output ./sam-template.yml
```Once you have exported the template, you can follow the standard procedure with the [AWS CLI](https://aws.amazon.com/cli/) to deploy the service. First, the package command reads the generated templates, uploads the packaged functions to an S3 bucket for deployment, and generates an output template with the S3 links to the function packages.
```
$ aws cloudformation package \
--template-file /path_to_template/template.yaml \
--s3-bucket bucket-name \
--output-template-file packaged-template.yaml
```The next step is to deploy the output template from the `package` command:
```
$ aws cloudformation deploy \
--template-file /path_to_template/packaged-template.yaml \
--stack-name my-new-stack \
--capabilities CAPABILITY_IAM
```