-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
92 lines (84 loc) · 2.24 KB
/
Copy pathserverless.yml
File metadata and controls
92 lines (84 loc) · 2.24 KB
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
org: respondlyai
app: upload-service
service: upload-service-lambda
provider:
name: aws
runtime: nodejs22.x
region: ap-south-1
stage: ${opt:stage, 'dev'}
memorySize: 256
timeout: 29
apiGateway:
restApiId:
Fn::ImportValue: ${self:provider.stage}-RespondlyAI-RestApiId
restApiRootResourceId:
Fn::ImportValue: ${self:provider.stage}-RespondlyAI-RootResourceId
environment:
NODE_ENV: ${self:provider.stage}
STAGE: ${self:provider.stage}
UPLOAD_BUCKET_NAME: ${self:custom.uploadBucketName}
UPLOAD_TABLE_NAME: ${self:custom.uploadTableName}
iam:
role:
statements:
- Effect: "Allow"
Action:
- "s3:PutObject"
- "s3:GetObject"
Resource: "arn:aws:s3:::${self:custom.uploadBucketName}/*"
- Effect: "Allow"
Action:
- "dynamodb:PutItem"
- "dynamodb:UpdateItem"
- "dynamodb:GetItem"
- "dynamodb:DeleteItem"
Resource:
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.uploadTableName}"
functions:
signedUrl:
handler: src/handler.signedUrl
events:
- http:
path: /upload/signed-url
method: post
cors: true
uploadComplete:
handler: src/handler.uploadComplete
events:
- http:
path: /upload/complete
method: post
cors: true
plugins:
- serverless-offline
custom:
serverless-offline:
httpPort: 3003
uploadBucketName: ${env:UPLOAD_BUCKET_NAME}
uploadTableName: ${env:UPLOAD_TABLE_NAME}
resources:
Resources:
UploadsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.uploadBucketName}
CorsConfiguration:
CorsRules:
- AllowedHeaders:
- "*"
AllowedMethods:
- PUT
- GET
AllowedOrigins:
- "*"
UploadsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.uploadTableName}
AttributeDefinitions:
- AttributeName: uploadId
AttributeType: S
KeySchema:
- AttributeName: uploadId
KeyType: HASH
BillingMode: PAY_PER_REQUEST