Skip to content

Instantly share code, notes, and snippets.

@khaledosman
Created September 19, 2019 11:55
Show Gist options
  • Save khaledosman/2a1f3ac6fd35c62448a11bb7c1e03da1 to your computer and use it in GitHub Desktop.
Save khaledosman/2a1f3ac6fd35c62448a11bb7c1e03da1 to your computer and use it in GitHub Desktop.
production ready serverless template
service:
name: <serviceName>
app: <serverless dashboard app name>
org: <serverless dashboard org name>
custom:
aws_profile: <aws profile>
warmup:
enabled: true
# Add the serverless-webpack plugin
plugins:
- serverless-webpack
- serverless-offline
- serverless-plugin-warmup
provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
profile: ${self:custom.aws_profile} # aws credentials profile to use
region: ${opt:region, 'eu-central-1'}
apiGateway: # Enable gzip
minimumCompressionSize: 0
tracing: #Enable xray tracing
apiGateway: true
lambda: true
environment:
NODE_ENV: PRODUCTION
iamRoleStatements:
- Effect: 'Allow'
Action:
- "lambda:InvokeFunction"
Resource:
- Fn::Join:
- ':'
- - arn:aws:lambda
- Ref: AWS::Region
- Ref: AWS::AccountId
- function:${self:service}-${self:provider.stage}-*
functions:
hello:
handler: handler.hello
events:
- http:
method: get
path: hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment