Serverless API Stage plugin, enables stage variables and logging for AWS API Gateway.
npm install serverless-api-stageAWS::APIGateway::Deployment resource, an AWS::APIGateway::Stage resource is also created.
StageName property of the deployment.
custom.stageSettings.Variables in your serverless.yml.
custom.stageSettings.MethodSettings in your
serverless.yml.
AWS::IAM::Role resource is created with the correct permissions to write Cloudwatch logs.
AWS::ApiGateway::Account settings resource.
yaml
#...
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.
Please don't update the version attribute in package.json, as multiple changes might be bundled into a single
release. Version bumps will be done in separate pull requests at the time of creating the release and publishing
to npm.
Plugin Roadmap
Due to discussion with contributors, there are some breaking changes to be made to the plugin, namely:
+ Make the Role creation optional (and change the default behaviour)
+ Standardise the LogicalId of the ApiGatewayStage` resource