-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathserverless.yml
More file actions
78 lines (72 loc) · 2.01 KB
/
serverless.yml
File metadata and controls
78 lines (72 loc) · 2.01 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
org: schmidtmark
app: betterblue-live-activity
service: betterblue-live-activity
custom:
apnsEnvironment:
dev: development
prod: production
provider:
name: aws
runtime: nodejs18.x
region: us-east-1
stage: ${opt:stage, 'dev'}
environment:
TABLE_NAME: betterblue-wakeup-schedules-${opt:stage, 'dev'}
# APNs credentials - set these via environment variables
APNS_KEY_ID: ${env:APNS_KEY_ID, 'LRNJLUAH2P'}
APNS_TEAM_ID: ${env:APNS_TEAM_ID, 'C2UW47HS8X'}
APNS_BUNDLE_ID: ${env:APNS_BUNDLE_ID, 'com.markschmidt.BetterBlue'}
APNS_ENVIRONMENT: ${self:custom.apnsEnvironment.${opt:stage, 'dev'}, 'development'}
APNS_KEY: ${ssm:/betterblue/apns-key} # Stored in AWS SSM Parameter Store
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:PutItem
- dynamodb:GetItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:Scan
- dynamodb:Query
Resource:
- Fn::GetAtt: [WakeUpTable, Arn]
# Fix for API Gateway CloudWatch role issue
logs:
restApi: false
functions:
registerWakeUp:
handler: handler.registerWakeUp
logRetentionInDays: 7
events:
- http:
path: wakeup
method: post
cors: true
unregisterWakeUp:
handler: handler.unregisterWakeUp
logRetentionInDays: 7
events:
- http:
path: wakeup/unregister
method: post
cors: true
sendWakeUps:
handler: handler.sendWakeUps
logRetentionInDays: 3 # Shortest retention for high-frequency function
events:
- schedule: rate(1 minute)
timeout: 60
resources:
Resources:
WakeUpTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: betterblue-wakeup-schedules-${opt:stage, 'dev'}
AttributeDefinitions:
- AttributeName: pushToken
AttributeType: S
KeySchema:
- AttributeName: pushToken
KeyType: HASH
BillingMode: PAY_PER_REQUEST