-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
84 lines (78 loc) · 2.07 KB
/
template.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Runtime: go1.x
Tags:
ProjectName: diomedes-search
Resources:
Search:
Type: AWS::Serverless::Function
Properties:
Handler: build/search
Environment:
Variables:
QUEUE_URL: !Ref MovieQueue
DDB_TABLE: !Ref MovieTable
Events:
CronEvent:
Type: Schedule
Properties:
Schedule: rate(1 minute)
Policies:
- DynamoDBReadPolicy:
TableName: !Ref MovieTable
- SQSSendMessagePolicy:
QueueName: !GetAtt MovieQueue.QueueName
Notification:
Type: AWS::Serverless::Function
Properties:
Handler: build/notification-telegram
Environment:
Variables:
# TIP: Set this after deployment from the AWS Console
# Ideally this should be loaded via Secrets Manager
TG_TOKEN: "Your token here"
DDB_TABLE: !Ref MovieTable
Events:
MovieEvent:
Type: SQS
Properties:
Queue: !GetAtt MovieQueue.Arn
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref MovieTable
MovieQueue:
Type: AWS::SQS::Queue
Properties:
Tags:
- Key: ProjectName
Value: diomedes-search
MovieTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: Id
AttributeType: S
KeySchema:
- AttributeName: Id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
Tags:
- Key: ProjectName
Value: diomedes-search
Outputs:
SearchFunction:
Description: "Diomedes Search Function Name"
Value: !Ref Search
NotificationFunction:
Description: "Diomedes Telegram Notification Function Name"
Value: !Ref Notification
SQSQueue:
Description: "SQS Queue URL for Movie Events"
Value: !Ref MovieQueue
DDBTable:
Description: "DynamoDB Table for Movie reminders"
Value: !Ref MovieTable