-
Notifications
You must be signed in to change notification settings - Fork 6
/
serverless.yml
166 lines (162 loc) · 4.6 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
service: pluto-web-client
plugins:
- serverless-pseudo-parameters
provider:
name: aws
runtime: nodejs12.x
region: us-east-1
role: WebClientRole
environment: ${file(./env/${opt:stage}.yml)}
logRetentionInDays: 30
apiGateway:
minimumCompressionSize: 0
binaryMediaTypes:
- '*/*'
package:
individually: true
functions:
render:
handler: ${file(./env/${opt:stage}.yml):HANDLER}
memorySize: 2048
timeout: 60
package:
artifact: dist.zip
events:
- http:
method: any
path: /
- http:
method: any
path: /{proxy+}
resources:
Resources:
APIProxyResourceParent:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
PathPart: api
RestApiId:
Ref: ApiGatewayRestApi
APIProxyResource:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Ref: APIProxyResourceParent
PathPart: '{proxy+}'
RestApiId:
Ref: ApiGatewayRestApi
APIProxyMethod:
Type: AWS::ApiGateway::Method
Properties:
ResourceId:
Ref: APIProxyResource
RestApiId:
Ref: ApiGatewayRestApi
HttpMethod: ANY
AuthorizationType: NONE
RequestParameters:
method.request.path.proxy: true
Integration:
IntegrationHttpMethod: any
Type: HTTP_PROXY
Uri: ${file(./env/${opt:stage}.yml):API_ENDPOINT}
RequestParameters:
integration.request.path.proxy: method.request.path.proxy
IntegrationResponses:
- StatusCode: 200
BundleProxyResourceParent:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
PathPart: bundle
RestApiId:
Ref: ApiGatewayRestApi
BundleProxyResource:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Ref: BundleProxyResourceParent
PathPart: '{proxy+}'
RestApiId:
Ref: ApiGatewayRestApi
BundleProxyMethod:
Type: AWS::ApiGateway::Method
Properties:
ResourceId:
Ref: BundleProxyResource
RestApiId:
Ref: ApiGatewayRestApi
HttpMethod: ANY
AuthorizationType: NONE
RequestParameters:
method.request.path.proxy: true
Integration:
IntegrationHttpMethod: any
Type: HTTP_PROXY
Uri: 'https://bundle.scinapse.io/{proxy}'
RequestParameters:
integration.request.path.proxy: method.request.path.proxy
IntegrationResponses:
- StatusCode: 200
WebClientRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- edgelambda.amazonaws.com
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Policies:
- PolicyName: SiteMapS3Role
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:*
Resource: "arn:aws:s3:::scinapse-sitemap/*"
- PolicyName: LambdaEdgeExecutionRole
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource: "*"
- PolicyName: XRayRole
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "xray:PutTraceSegments"
- "xray:PutTelemetryRecords"
Resource: "*"
- PolicyName: LambdaMetricPolicy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- cloudwatch:PutMetricData
Resource: "*"
- PolicyName: SSMPolicy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- ssm:GetParameter
Resource: "arn:aws:ssm:#{AWS::Region}:#{AWS::AccountId}:parameter/scinapse-web-client/dev/branch-mapper"