-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
125 lines (122 loc) · 3.68 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
service: serverless-chaos-demo-nodejs
frameworkVersion: ">=1.34.0 <2.0.0"
provider:
name: aws
runtime: nodejs10.x
memorySize: 128
iamRoleStatements:
- Effect: Allow
Action:
- ssm:GetParameters
- ssm:GetParameter
Resource:
Fn::Join:
- ''
- - 'arn:aws:ssm:${opt:region, self:provider.region}:*:parameter/'
- Ref: failureLambdaParameter1
- Effect: Allow
Action:
- ssm:GetParameters
- ssm:GetParameter
Resource:
Fn::Join:
- ''
- - 'arn:aws:ssm:${opt:region, self:provider.region}:*:parameter/'
- Ref: failureLambdaParameter2
- Effect: Allow
Action:
- ssm:GetParameters
- ssm:GetParameter
Resource:
Fn::Join:
- ''
- - 'arn:aws:ssm:${opt:region, self:provider.region}:*:parameter/'
- Ref: failureLambdaParameter3
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
Fn::Join:
- ''
- - 'arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/'
- Ref: failureLambdaTable
functions:
failureLambdaFunction1:
handler: index.handler
timeout: 3
environment:
FAILURE_INJECTION_PARAM:
Ref: failureLambdaParameter1
FAILURE_INJECTION_TABLE:
Ref: failureLambdaTable
events:
- http:
path: failureLambdaFunction1/
method: get
cors: true
failureLambdaFunction2:
handler: index.handler
timeout: 3
environment:
FAILURE_INJECTION_PARAM:
Ref: failureLambdaParameter2
FAILURE_INJECTION_TABLE:
Ref: failureLambdaTable
events:
- http:
path: failureLambdaFunction2/
method: get
cors: true
failureLambdaFunction3:
handler: index.handler
timeout: 3
environment:
FAILURE_INJECTION_PARAM:
Ref: failureLambdaParameter3
FAILURE_INJECTION_TABLE:
Ref: failureLambdaTable
events:
- http:
path: failureLambdaFunction3/
method: get
cors: true
resources:
Resources:
failureLambdaParameter1:
Type: 'AWS::SSM::Parameter'
Properties:
Type: String
Value: '{"isEnabled": false, "failureMode": "latency", "rate": 1, "minLatency": 100, "maxLatency": 400, "exceptionMsg": "Exception message!", "statusCode": 404, "diskSpace": 100, "denylist": ["s3.*.amazonaws.com", "dynamodb.*.amazonaws.com"]}'
failureLambdaParameter2:
Type: 'AWS::SSM::Parameter'
Properties:
Type: String
Value: '{"isEnabled": false, "failureMode": "latency", "rate": 1, "minLatency": 100, "maxLatency": 400, "exceptionMsg": "Exception message!", "statusCode": 404, "diskSpace": 100, "denylist": ["s3.*.amazonaws.com", "dynamodb.*.amazonaws.com"]}'
failureLambdaParameter3:
Type: 'AWS::SSM::Parameter'
Properties:
Type: String
Value: '{"isEnabled": false, "failureMode": "latency", "rate": 1, "minLatency": 100, "maxLatency": 400, "exceptionMsg": "Exception message!", "statusCode": 404, "diskSpace": 100, "denylist": ["s3.*.amazonaws.com", "dynamodb.*.amazonaws.com"]}'
failureLambdaTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: N
KeySchema:
-
AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
package:
exclude:
- ./client/**
- .vscode
- .serverless