forked from FormidableLabs/aws-lambda-serverless-reference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
84 lines (76 loc) · 2.22 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# CloudFormation output name: `sls-${SERVICE_NAME}-${STAGE}`
service: sls-${self:custom.service}
package:
include:
# Root level
- "!*"
- "package.json"
# Source directories
- "src/**"
- "!aws/**"
- "!terraform"
- "!terraform/**"
# General exclusions
- "!**/.DS_Store"
# Dependencies
- "!node_modules/aws-sdk"
- "!node_modules/aws-sdk/**"
- "!**/node_modules/aws-sdk"
- "!**/node_modules/aws-sdk/**"
- "!**/node_modules/*/CHANGELOG.md"
- "!**/node_modules/*/HISTORY.md"
- "!**/node_modules/*/LICENSE"
- "!**/node_modules/*/README.md"
custom:
service: ${env:SERVICE_NAME}
region: ${opt:region, env:AWS_REGION}
stage: ${opt:stage, env:STAGE}
plugins:
- serverless-jetpack
- serverless-offline
provider:
name: aws
runtime: nodejs8.10
region: ${self:custom.region}
stage: ${self:custom.stage}
environment:
STAGE: ${self:custom.stage}
SERVICE_NAME: ${self:custom.service}
timeout: 30 # seconds (`300` max)
memorySize: 128 # MB value (`1024` default)
functions:
# SCENARIO - base: The simplest, vanilla Serverless app.
base:
handler: src/server/base.handler
events: # Use a generic proxy to allow Express app to route.
- http: ANY /base
- http: 'ANY /base/{proxy+}'
# SCENARIO - xray: Simple app with Xray tracing.
xray:
handler: src/server/xray.handler
events:
- http: ANY /xray
- http: 'ANY /xray/{proxy+}'
# SCENARIO - vpc: Our vanilla app, but in a VPC
vpc:
handler: src/server/base.handler
events:
- http: ANY /vpc
- http: 'ANY /vpc/{proxy+}'
environment:
BASE_URL: /vpc
# VPC: Add in SGs and SNs.
# https://serverless.com/framework/docs/providers/aws/guide/functions#vpc-configuration
vpc:
securityGroupIds:
- Fn::ImportValue: "tf-${self:custom.service}-${self:custom.stage}-VPCSecurityGroupId"
subnetIds:
- Fn::ImportValue: "tf-${self:custom.service}-${self:custom.stage}-VPCPrivateSubnetA"
- Fn::ImportValue: "tf-${self:custom.service}-${self:custom.stage}-VPCPrivateSubnetB"
resources:
Resources:
# OPTION(Xray): Enable Xray tracing.
XrayLambdaFunction:
Properties:
TracingConfig:
Mode: Active