Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

AWS API Gateway stage plugin for serverless framework

Notifications You must be signed in to change notification settings

nbcdotcom/serverless-api-stage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless API Stage plugin

Build Status License: MIT

Plugin for the serverless framework that allows the use of stages with defined stage variables and logging configuration, when using the AWS provider.

This is a rewritten plugin with the same functionality provided by two existing plugins:

Namely:

  • In addition to the AWS::APIGateway::Deployment resource, an AWS::APIGateway::Stage resource is also created.
  • The stage is linked to the deployment, to replace the StageName property of the deployment.
  • The stage may have stage variables defined by custom.stageSettings.Variables in your serverless.yml.
  • The stage may have logging and other method properties defined by custom.stageSettings.MethodSettings in your serverless.yml.
  • An AWS::IAM::Role resource is created with the correct permissions to write Cloudwatch logs.
  • This IAM Role for logs is set in the AWS::ApiGateway::Account settings resource.

Installation

Install the plugin via npm.

Usage Example

#...
plugins:
  - serverless-api-stage
#...
custom:
  stageSettings:
    CacheClusterEnabled: true
    CacheClusterSize: '0.5'
    Variables:
      foo: bar
      baz: xyzzy
    MethodSettings:
      LoggingLevel: INFO
      CachingEnabled: true
      CacheTtlInSeconds: 3600
      # see below...
#...

The full list of MethodSettings available are defined in the AWS CloudFormation documentation.

Contributors

Please contribute by submitting a pull request, or raising an issue.

Code changes or additions should include corresponding unit test changes or additions. Tests can be run locally using npm test. This requires global installation of jshint and mocha (npm install -g jshint mocha).

About

AWS API Gateway stage plugin for serverless framework

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%