-
Notifications
You must be signed in to change notification settings - Fork 12
/
serverless.yml
40 lines (35 loc) · 958 Bytes
/
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
service: s3-file-uploader
provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-west-1
custom:
fileUploadBucketName: ${self:service}-bucket-${self:provider.stage}
plugins:
- serverless-iam-roles-per-function
functions:
s3FileUploader:
handler: src/upload.handler
name: s3-file-uploader
description: A lambda handler that uploads a file to an S3 bucket based on an API Gateway trigger.
timeout: 60 # seconds
memorySize: 128 # mb
events:
- http:
path: images
method: POST
iamRoleStatements:
- Effect: Allow
Action:
- "s3:Put*"
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