This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
62 lines (58 loc) · 1.58 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
service: just-scored
provider:
name: aws
runtime: go1.x
stage: ${opt:stage, 'prod'}
region: ${opt:region, 'us-east-1'}
environment:
DYNAMODB_TABLE: ${self:service}-${self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:*
Resource: "arn:aws:dynamodb:${self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
package:
exclude:
- ./**
include:
- ./bin/**
functions:
goal-checker:
description: Check for recently scored World Cup goals and add them to DynamoDB
handler: bin/goal-checker
events:
# Every minute 12am to 2pm Moscow time (UTC+3)
- schedule: cron(* 9-23 * * ? *)
goal-notifier:
description: Send Slack notifications about recently scored World Cup goals
handler: bin/goal-notifier
environment:
SLACK_WEBHOOK_URLS: ${env:SLACK_WEBHOOK_URLS}
events:
- stream:
type: dynamodb
batchSize: 1
startingPosition: LATEST
arn:
Fn::GetAtt:
- GoalsDynamoDBTable
- StreamArn
resources:
Resources:
GoalsDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE}
AttributeDefinitions:
-
AttributeName: EventID
AttributeType: N
KeySchema:
-
AttributeName: EventID
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: NEW_IMAGE