-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
52 lines (46 loc) · 1.1 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
service: upload-to-s3
frameworkVersion: '3'
plugins:
- serverless-offline
- serverless-plugin-typescript
- serverless-iam-roles-per-function
custom:
fileUploadBucketName: ${self:service}-bucket-${self:provider.stage}
serverless-offline:
httpPort: 1337
provider:
name: aws
runtime: nodejs12.x
profile: serverlessUser
stage: dev
region: ap-south-1
functions:
hello:
handler: src/lambda/hello.handler
events:
- http:
path: /hello
method: GET
cors: true
imageUpload:
handler: src/lambda/imageUpload.handler
events:
- http:
path: /imageUpload
method: POST
cors: true
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObjectAcl
- s3:PutObject
Resource: arn:aws:s3:::${self:custom.fileUploadBucketName}/*
environment:
FILE_UPLOAD_BUCKET_NAME: ${self:custom.fileUploadBucketName}
resources:
Resources:
FileBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.fileUploadBucketName}
AccessControl: PublicRead