-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtemplate.yaml
57 lines (56 loc) · 1.67 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Parameters:
ALGOLIA_APP_ID:
Type: String
Description: Algolia App ID.
Default: ''
ALGOLIA_API_KEY:
Type: String
Description: Algolia API Key.
Default: ''
ALGOLIA_FIELDS_MAP:
Type: String
Description: Fields To create indexes for in Algolia.
Default: '{"ExampleTable":{"include": ["two"]}}'
# Default: '{"exclude": ["one", "three"]}'
ALGOLIA_SETTINGS_MAP:
Type: String
Description: Algolia Index Settings.
Default: '{"ExampleTable":{"settings": {"ranking":["words", "typo"]}}}'
Resources:
ProcessDynamoDBStream:
Type: AWS::Serverless::Function
Properties:
CodeUri: algolia-lambda/package/
Handler: python_algolia_function.lambda_handler
Runtime: python3.8
Timeout: 10
Policies: AWSLambdaDynamoDBExecutionRole
Environment:
Variables:
ALGOLIA_APP_ID: !Ref ALGOLIA_APP_ID
ALGOLIA_API_KEY: !Ref ALGOLIA_API_KEY
ALGOLIA_FIELDS_MAP: !Ref ALGOLIA_FIELDS_MAP
ALGOLIA_SETTINGS_MAP: !Ref ALGOLIA_SETTINGS_MAP
Events:
Stream:
Type: DynamoDB
Properties:
Stream: !GetAtt DynamoDBTable.StreamArn
BatchSize: 100
StartingPosition: TRIM_HORIZON
DynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES