-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
90 lines (86 loc) · 2.65 KB
/
Copy pathserverless.yml
File metadata and controls
90 lines (86 loc) · 2.65 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
79
80
81
82
83
84
85
86
87
88
89
90
service: pushnotification
custom:
userDeviceTokenTableName: 'user-device-token-${self:provider.stage}'
provider:
name: aws
runtime: java11
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'ap-northeast-1'}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: 'arn:aws:dynamodb:ap-northeast-1:*:*'
environment:
USER_DEVICE_TOKEN_TABLE_NAME: ${self:custom.userDeviceTokenTableName}
package:
artifact: 'target/${self:service}-${self:provider.stage}.jar'
functions:
getUserSubscription:
handler: com.me.awslambdatest.handlers.GetUserSubscriptionHandler::handleRequest
events:
- http:
path: /user/{id}/subscriptions
method: get
registerUserDevice:
handler: com.me.awslambdatest.handlers.RegisterUserDeviceHandler::handleRequest
events:
- http:
path: /user/subscription
method: post
unregisterUserDevice:
handler: com.me.awslambdatest.handlers.UnregisterUserDeviceHandler::handleRequest
timeout: 20
events:
- http:
path: /user/{id}/device/{deviceId}
method: delete
resources:
Resources:
UserDeviceTokenDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.userDeviceTokenTableName}
AttributeDefinitions:
- AttributeName: "PartitionKey"
AttributeType: "S"
- AttributeName: "GSI1PartitionKey"
AttributeType: "S"
- AttributeName: "GSI2PartitionKey"
AttributeType: "S"
GlobalSecondaryIndexes:
- IndexName: "GSI1"
KeySchema:
- AttributeName: "GSI1PartitionKey"
KeyType: "HASH"
Projection:
NonKeyAttributes:
- "Token"
ProjectionType: "INCLUDE"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
- IndexName: "GSI2"
KeySchema:
- AttributeName: "GSI2PartitionKey"
KeyType: "HASH"
Projection:
NonKeyAttributes:
- "DeviceId"
ProjectionType: "INCLUDE"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
KeySchema:
- AttributeName: "PartitionKey"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5