-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
83 lines (80 loc) · 1.84 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
service: fylz-api
frameworkVersion: '>=1.28.0 <2.0.0'
provider:
name: aws
runtime: go1.x
stage: prod
custom:
bucketName: fylz-files
environment:
S3_REGION: us-east-1
S3_BUCKET: ${self:provider.custom.bucketName}
region: us-east-1
apiGateway:
binaryMediaTypes:
- '*/*'
iamRoleStatements:
- Effect: "Allow"
Action: [ "s3:ListBucket", "s3:PutObject", "s3:GetObject", "s3:DeleteObject", ]
Resource: arn:aws:s3:::${self:provider.custom.bucketName}/*
- Effect: "Allow"
Action: [ "s3:ListBucket" ]
Resource: arn:aws:s3:::${self:provider.custom.bucketName}
package:
exclude:
- ./**
include:
- ./bin/**
functions:
upload:
handler: bin/api/upload
events:
- http:
path: api/files/upload/{filename}
method: put
request:
parameters:
paths:
filename: true
download:
handler: bin/api/download
events:
- http:
path: api/files/{id}
method: get
request:
parameters:
paths:
id: true
url:
handler: bin/api/url
events:
- http:
path: api/url/{action}
method: get
request:
parameters:
paths:
action: true
list:
handler: bin/api/list
events:
- http:
path: api/files
method: get
Resources:
IamRoleLambdaExecution:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
- edgelambda.amazonaws.com
- apigateway.amazonaws.com
FileBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:provider.custom.bucketName}