A serverless plugin to deploy applications to AWS ElasticBeanstalk.
- This plugin is dependent on the output of Stack Config Plugin for Serverless
elastic-beanstalk
- This uploads an ElasticBeanstalk application.
npm install --save serverless-plugin-elastic-beanstalk
Add the plugin to your serverless.yml
like the following:
provider:
...
plugins:
- serverless-plugin-elastic-beanstalk
custom:
elastic-beanstalk:
variables:
applicationName: CartApplicationName
environmentName: CartApplicationEvironmentName
key: ${opt:key}
file:
prefix: bundles
name: bundle-latest.zip
platform: nodejs
script: scripts/configure.js
build:
babel: true
sourceMaps: true
include:
- .ebextensions/**
- src/**
- resources/schema/**
- package.json
functions:
...
resources:
Resources:
CartApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
ApplicationName: ${self:service}
Description: Cart application
CartEnvironment:
Type: AWS::ElasticBeanstalk::Environment
Properties:
ApplicationName:
Ref: CartApplication
Description: Cart environment
SolutionStackName: '64bit Amazon Linux 2017.03 v4.4.5 running Node.js'
OptionSettings:
- Namespace: aws:elasticbeanstalk:container:nodejs
OptionName: NodeVersion
Value: '7.6.0'
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: SingleInstance
...
Outputs:
CartApplicationName:
Description: Cart application name
Value:
Ref: CartApplication
CartApplicationEvironmentName:
Description: Cart environment name
Value:
Ref: CartEnvironment
...
NOTE: If providing a custom script, that script must be exported from the module using module.exports
.
serverless elastic-beanstalk --stage dev --region eu-west-1 --key ec2-key
MIT