-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserverless.yml
111 lines (106 loc) · 3.75 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
service: lambdora
frameworkVersion: ">=1.2.0 <2.0.0"
provider:
name: aws
runtime: java8
environment: # Service wide environment variables
DYNAMODB_TABLE: RESOURCE_TRIPLE
NOTIFICATION_EMAIL: [email protected]
iamRoleStatements: # IAM role statements which are applied to role attached to lambda functions
# Allows code in lambda function to read/write data in DynamoDB
# This list of actions is a subset of those available from DynamoDB, based on the expected needs of this project
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
# Allows the above actions to be performed on the DynamoDb table and indexes created in the resources below
Resource:
- "arn:aws:dynamodb:*:*:table/${self:provider.environment.DYNAMODB_TABLE}"
- "arn:aws:dynamodb:*:*:table/${self:provider.environment.DYNAMODB_TABLE}/index/*"
# Allows Lambda to write to an SNS topic as a dead letter queue
- Effect: Allow
Action:
- sns:Publish
Resource:
Ref: DeadLetterQueue
package:
artifact: lambdora-http-api/build/distributions/lambdora-http-api-0.1.0-SNAPSHOT.zip
functions:
ldpJersey:
handler: org.fcrepo.lambdora.ldp.JerseyRequestHandler
events:
- http:
path: /{thepath+}
method: any
- http:
path: /
method: any
onError:
Ref: DeadLetterQueue
timeout: 20
resources:
Resources:
# Creates DynamoDB table named "RESOURCE_TRIPLE" with primary, composite key of "resource_name" and "rdf_triple"
# This table also has two indexes (see comments below)
resourceTripleTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE}
AttributeDefinitions:
- AttributeName: resource_name
AttributeType: S
- AttributeName: rdf_triple
AttributeType: S
- AttributeName: rdf_predicate
AttributeType: S
- AttributeName: rdf_object
AttributeType: S
KeySchema:
- AttributeName: resource_name
KeyType: HASH
- AttributeName: rdf_triple
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
LocalSecondaryIndexes:
# Index providing a secondary sort on rdf_predicate to allow querying by resource_name + rdf_predicate
- IndexName: predicateIndex
KeySchema:
- AttributeName: resource_name
KeyType: HASH
- AttributeName: rdf_predicate
KeyType: RANGE
Projection:
NonKeyAttributes:
- rdf_subject
- rdf_object
ProjectionType: INCLUDE
GlobalSecondaryIndexes:
# Index providing ability to query on referenced rdf_object and/or rdf_predicate
- IndexName: objectIndex
KeySchema:
- AttributeName: rdf_object
KeyType: HASH
- AttributeName: rdf_predicate
KeyType: RANGE
Projection:
NonKeyAttributes:
- rdf_subject
ProjectionType: INCLUDE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
# Creates an SNS topic which is used to capture failed lambda responses
DeadLetterQueue:
Type: AWS::SNS::Topic
Properties:
TopicName: lambda-dead-letter
Subscription:
- Endpoint: ${self:provider.environment.NOTIFICATION_EMAIL}
Protocol: email