-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
167 lines (159 loc) · 4.33 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: game-of-life-v10
plugins:
- serverless-s3-sync
custom:
bucket: game-of-life-bucket-v10 # edit this processing bucket field to a unique name
uibucket: game-of-life-ui-v10 # edit this frontend hosting field to a unique name
s3Sync:
- bucketName: ${self:custom.uibucket}
localDir: static
provider:
name: aws
profile: default # Set to same as AWS CLI profile
runtime: python3.8
memorySize: 2048
logRetentionInDays: 7
versionFunctions: false
endpointType: REGIONAL
iam:
role:
statements:
- Effect: Allow
Action:
- s3:*
- logs:CreateLogStream
- logs:CreateLogGroup
Resource: '*'
environment:
s3_bucket: ${self:custom.bucket}
resources:
Resources:
GolSite:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.uibucket}
CorsConfiguration:
CorsRules:
- AllowedHeaders:
- '*'
AllowedMethods:
- GET
AllowedOrigins:
- '*'
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: false
IgnorePublicAcls: true
RestrictPublicBuckets: false
WebsiteConfiguration:
IndexDocument: index.html
BucketPolicyGolSite:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${self:custom.uibucket}
PolicyDocument:
Statement:
- Sid: AllowPublicRead
Effect: Allow
Principal: "*"
Action:
s3:GetObject
Resource:
Fn::Join: [
"", [
"arn:aws:s3:::",
{
"Ref": "GolSite"
},
"/*"
]
]
GolImgDump:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.bucket}
CorsConfiguration:
CorsRules:
- AllowedHeaders:
- '*'
AllowedMethods:
- POST
- GET
AllowedOrigins:
- '*'
LifecycleConfiguration:
Rules:
- Id: ClearBucket
ExpirationInDays: 1
Status: Enabled
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: false
IgnorePublicAcls: true
RestrictPublicBuckets: false
BucketPolicyGol1:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${self:custom.bucket}
PolicyDocument:
Statement:
- Sid: AllowPublicWrite
Effect: Allow
Principal: "*"
Action:
- s3:PutObject
Resource:
Fn::Join: [
"", [
"arn:aws:s3:::",
{
"Ref": "GolImgDump"
},
"/*"
]
]
- Sid: AllowPublicRead
Effect: Allow
Principal: "*"
Action:
- s3:GetObject
Resource:
Fn::Join: [
"", [
"arn:aws:s3:::",
{
"Ref": "GolImgDump"
},
"/*"
]
]
functions:
request_handler:
handler: request_handler.request_handler
events:
- http:
path: '/'
method: get
cors:
origin: '*'
request:
parameters:
querystrings:
ext: true # extension
evo: true # number evolutions evo
scale: true # zoom ratio scale
dur: true # duration in ms fps
thresh: true # image threshold
noise: true # whether to add noise
worker:
handler: worker.worker_handler
memorySize: 10240
timeout: 900
events:
- s3:
bucket: ${self:custom.bucket}
event: s3:ObjectCreated:*
existing: true
layers:
- arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python38-SciPy1x:29
- arn:aws:lambda:us-east-1:770693421928:layer:Klayers-python38-Pillow:9