-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
95 lines (82 loc) · 3.56 KB
/
serverless.yml
File metadata and controls
95 lines (82 loc) · 3.56 KB
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
85
86
87
88
89
90
91
92
93
94
95
service: lambda-url
frameworkVersion: "=3.12.0"
provider:
name: aws
runtime: nodejs14.x
region: eu-west-1
stage: dev
# Environment variables common to all Lambda functions in the stack. Lambda-
# specific environment variables are merged with these and take precedence
# where duplicated.
environment:
NODE_OPTIONS: --enable-source-maps
# Disable the versioning of Lambda function deployments. By default the
# Serverless Framework creates a new Lambda version every time it deploys a
# Lambda function which quickly leads to a large number of redundant versions
# in the AWS account. There is little benefit to function versioning except in
# specific use cases that require more thought and configuration such as
# canary deployments.
versionFunctions: false
# Enable API Gateway request logging. The default configuration includes full
# request/response logging to a CloudWatch log group and access logging to
# another. AWS does not recommend enabling full request/response logging in
# production environments due to the potential for recording sensitive data.
# This may be something to revisit and make more configurable via an option.
logs:
restApi: true
websocket: true
# Opt-in to the new naming convention for API Gateway resources.
apiGateway:
shouldStartNameWithService: true
# IAM role for all functions. We define X-Ray permissions here because the
# serverless-iam-roles-per-function plugin does not yet have the ability to
# automatically add them based on the tracing config below.
#
# The format of this property is changing in the next major version of the
# Serverless Framework and using this old pattern logs a deprecation warning
# during deployment. Unfortunately, serverless-iam-roles-per-function does not
# yet support the new format.
iamRoleStatements:
- Effect: Allow
Action:
- xray:PutTelemetryRecords
- xray:PutTraceSegments
Resource: "*"
package:
individually: true
# Lambda function definitions. Each function defines itself in a separate YAML
# file that resides alongside the function implementation. Unfortunately we have
# to duplicate the function name here due to the way Serverless YAML importing
# and parsing works (in an ideal world we could include these in a list as we do
# for resources).
functions:
lambdaUrlSlackHook: ${file(src/functions/lambda-url-slack-hook/index.yml):lambdaUrlSlackHook}
apiGatewaySlackHook: ${file(src/functions/api-gateway-slack-hook/index.yml):apiGatewaySlackHook}
# Custom AWS resource definitions. This includes anything that the Serverless
# framework doesn't handle for us, such as database setup, and overrides of
# Serverless defaults.
#
# An example file has been included here to demonstrate the way we like to
# separate custom CloudFormation resources into files by type. You can safely
# delete the example file and this reference to it.
resources:
- ${file(src/resources/sns.yml)}
# Custom configuration. This is where Serverless Framework plugins get their
# configuration from.
custom:
stage: ${opt:stage, self:provider.stage}
splitStacks:
perFunction: true
perType: false
# Merge per-function IAM role configuration with the provider-level role
# configuration.
serverless-iam-roles-per-function:
defaultInherit: true
# Serverless plugins. The "split-stacks" plugin is used to generate nested
# CloudFormation stacks to work around the hard limit of 200 resources per
# stack.
plugins:
- serverless-webpack
- serverless-offline
- serverless-iam-roles-per-function
- serverless-plugin-split-stacks