-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
103 lines (91 loc) · 2.13 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
service: lambda-authorizer-demo
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs12.x
region: us-east-1
stage: dev
lambdaHashingVersion: 20201221
# API HTTP
httpApi:
authorizers:
customAuthorizer:
type: request
functionName: custom-authorizer-http
iamRoleStatements:
- Effect: "Allow"
Action: "secretsmanager:GetSecretValue"
Resource: "*"
- Effect: Allow
Action:
- codedeploy:*
Resource:
- "*"
tracing:
lambda: true
environment:
NODE_PATH: "./:/opt"
package:
exclude:
- layes/secretsManager/**
plugins:
- serverless-plugin-aws-alerts
- serverless-plugin-canary-deployments
- serverless-api-gateway-throttling
- serverless-add-api-key
- serverless-offline
custom:
alerts:
dashboards: true
# They apply to all http endpoints, unless specifically overridden
apiGatewayThrottling:
maxRequestsPerSecond: 1000
maxConcurrentRequests: 500
serverless-offline:
ignoreJWTSignature: true
apiKeys:
dev:
- name: dev/api-key-private
layers:
SecretsManager:
path: layers/secretsManager
description: "script to handle with AWS SecretsManager"
functions:
hello:
handler: handler.hello
events:
- http:
path: /hello-rest
method: get
private: true
authorizer: custom-authorizer-rest # API REST
throttling:
maxRequestsPerSecond: 2000
maxConcurrentRequests: 1000
deploymentSettings:
type: Canary10Percent5Minutes
alias: Live
preTrafficHook: preHook
postTrafficHook: postHook
alarms:
- name: LambdaTestAlarmA
hello-http:
handler: handler.hello
events:
- httpApi:
path: /hello-http
method: get
authorizer:
name: customAuthorizer
custom-authorizer-rest:
handler: authorizer-rest.handler
layers:
- { Ref: SecretsManagerLambdaLayer }
custom-authorizer-http:
handler: authorizer-http.handler
layers:
- { Ref: SecretsManagerLambdaLayer }
preHook:
handler: hooks.pre
postHook:
handler: hooks.post