-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
61 lines (56 loc) · 1.41 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
service: s3-bucket-api
provider:
name: aws
runtime: nodejs18.x
stage: dev
region: ap-south-1
apiName: ${self:service}
memorySize: 256 # in MB
timeout: 30 # in seconds
environment:
FILE_UPLOAD_BUCKET_NAME: ${self:custom.bucketName}
plugins:
- serverless-iam-roles-per-function
custom:
bucketName: s3-crud-bucket-api
functions:
s3FileUploader:
handler: dist/handlers/uploadFile.uploadFileHandler
name: s3-file-uploader
events:
- http:
path: upload
method: POST
iamRoleStatements:
- Effect: Allow
Action: s3:PutObject
Resource: arn:aws:s3:::${self:custom.bucketName}/*
s3FileDownloader:
handler: dist/handlers/getFile.getFileHandler
name: s3-file-downloader
events:
- http:
path: files/{id}
method: GET
iamRoleStatements:
- Effect: Allow
Action: s3:GetObject
Resource: arn:aws:s3:::${self:custom.bucketName}/*
s3fileDelete:
handler: dist/handlers/deleteFile.deleteFileHandler
name: s3-file-delete
events:
- http:
path: delete/{id}
method: DELETE
iamRoleStatements:
- Effect: Allow
Action: s3:DeleteObject
Resource: arn:aws:s3:::${self:custom.bucketName}/*
resources:
Resources:
FileBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.bucketName}
AccessControl: Private