-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
86 lines (76 loc) · 2.55 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
84
85
86
service:
name: sls-auction
plugins:
- serverless-bundle
- serverless-pseudo-parameters # I can use parameters #{AWS::Region}, not eu-west-1. #{AWS::AccountId}, not 482672519558
provider:
name: aws
runtime: nodejs14.x
memorySize: 256
stage: ${opt:stage, 'dev'}
region: eu-west-1
environment:
AUCTIONS_TABLE_NAME: ${self:custom.AuctionsTable.name}
MAIL_QUEUE_URL: ${self:custom.MailQueue.url}
AUCTIONS_BUCKET_NAME: ${self:custom.AuctionsBucket.name}
iamRoleStatements:
- ${file(iam/AuctionsTableIAM.yml):AuctionsTableIAM}
- ${file(iam/MailQueueIAM.yml):MailQueueIAM}
- ${file(iam/AuctionsBucketIAM.yml):AuctionsBucketIAM}
resources:
Resources:
AuctionsTable: ${file(resources/AuctionsTable.yml):AuctionsTable}
AuctionsBucket: ${file(resources/AuctionsBucket.yml):AuctionsBucket}
AuctionsBucketPolicy: ${file(resources/AuctionsBucket.yml):AuctionsBucketPolicy}
functions:
createAuction:
handler: src/handlers/createAuction.handler
events:
- http:
method: POST
path: /auction
authorizer: ${self:custom.authorizer}
getAuctions:
handler: src/handlers/getAuctions.handler
events:
- http:
method: GET
path: /auctions
authorizer: ${self:custom.authorizer}
getAuction:
handler: src/handlers/getAuction.handler
events:
- http:
method: GET
path: /auction/{id}
authorizer: ${self:custom.authorizer}
placeBid:
handler: src/handlers/placeBid.handler
events:
- http:
method: PATCH
path: /auction/{id}/bid
authorizer: ${self:custom.authorizer}
uploadAuctionPicture:
handler: src/handlers/uploadAuctionPicture.handler
events:
- http:
method: PATCH
path: auction/{id}/picture
authorizer: ${self:custom.authorizer}
processAuctions:
handler: src/handlers/processAuctions.handler
events:
- schedule: rate(1 minute)
custom:
authorizer: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:auth-service-${self:provider.stage}-auth # arn:aws:lambda:eu-west-1:482672519558:function:auth-service-dev-auth
AuctionsTable:
name: !Ref AuctionsTable
arn: !GetAtt AuctionsTable.Arn
MailQueue:
arn: ${cf:notification-service-${self:provider.stage}.MailQueueArn} # cf = CloudFormation
url: ${cf:notification-service-${self:provider.stage}.MailQueueUrl}
AuctionsBucket:
name: auctions-bucket-textforuniquename-${self:provider.stage} # must be unique name!!! not upper case!
bundle:
linting: false