This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
executable file
·90 lines (83 loc) · 2.18 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
87
88
89
90
service: sls-booking-system
plugins:
- serverless-pseudo-parameters
provider:
name: aws
runtime: dotnetcore3.1
stage: ${opt:stage, 'stage'}
region: eu-west-2
timeout: 30
memorySize: 512
logRetentionInDays: 14
versionFunctions: false
profile: sandbox
feature: booking-system
stackTags:
FEATURE: ${self:provider.feature}
ENVIRONMENT: ${self:provider.stage}
tags:
FEATURE: ${self:provider.feature}
ENVIRONMENT: ${self:provider.stage}
VERSION: ${env:VERSION}
environment:
ENVIRONMENT: ${self:provider.stage}
VERSION: ${env:VERSION}
DEPLOYED_DATE: ${env:DEPLOYED_DATE}
TABLE_NAME: ${self:custom.tableName}
BOOKING_CREATED_TOPIC: !Ref BookingCreatedTopic
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:PutItem
- dynamodb:DescribeTable
- dynamodb:Query
Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:custom.tableName}
- Effect: Allow
Action:
- sns:Publish
Resource: !Ref BookingCreatedTopic
package:
artifact: package.zip
functions:
create:
handler: booking-system::LambdaHandlers::createBooking
events:
- http:
method: post
path: create
list:
handler: booking-system::LambdaHandlers::listBookings
events:
- http:
method: post
path: list
# bookingCreatedNotification:
# handler: booking-system::LambdaHandlers::bookingCreatedNotification
# events:
# - sns:
# arn: !Ref BookingCreatedTopic
custom:
tableName: bookings-table
topics:
bookingCreated: booking-created
resources:
Resources:
BookingsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: CustomerId
AttributeType: S
- AttributeName: Id
AttributeType: S
KeySchema:
- AttributeName: CustomerId
KeyType: HASH
- AttributeName: Id
KeyType: RANGE
BillingMode: PAY_PER_REQUEST
BookingCreatedTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: ${self:custom.topics.bookingCreated}