-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdata_consumer_template.yaml
78 lines (78 loc) · 2.17 KB
/
data_consumer_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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
AWSTemplateFormatVersion: 2010-09-09
Description: >
Analyze videos from different sites and tag these videos.
Parameters:
Prefix:
Default: 'poc'
Type: String
Description: >
Resource name in this template should be prefixed with this word
ImageUri:
Default: stack-vpc
Type: String
Description: >
Stack name of VPC used to deploy the following infrastructure.
KinesisStreamName:
Default: stream
Type: String
Description: >
Stack name of Image Builder.
Resources:
LambdaKinesisRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Join ['-', [!Ref Prefix, 'LambdaKinesisRole', !Ref 'AWS::Region']]
Description: >
'Role for executing kinesis lambda function.'
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/AmazonKinesisFullAccess'
- 'arn:aws:iam::aws:policy/AWSLambdaExecute'
ReadRecordFromKinesis:
Type: 'AWS::Lambda::Function'
DependsOn: LambdaKinesisRole
Properties:
FunctionName: !Join ['-', [!Ref Prefix, 'kinesis-reader']]
Description: 'Download video from website and tag it.'
PackageType: 'Image'
MemorySize: 256
Code:
ImageUri: !Ref ImageUri
ImageConfig:
Command:
- 'forward_to_shushu.handler'
Role: !GetAtt LambdaKinesisRole.Arn
Timeout: 30
# Runtime: 'nodejs14.x'
ReservedConcurrentExecutions: 10
MyEventSourceMapping:
Type: AWS::Lambda::EventSourceMapping
DependsOn: ReadRecordFromKinesis
Properties:
EventSourceArn:
Fn::Join:
- ""
-
- "arn:aws:kinesis:"
-
Ref: "AWS::Region"
- ":"
-
Ref: "AWS::AccountId"
- ":stream/"
-
Ref: "KinesisStreamName"
FunctionName:
Fn::GetAtt:
- "ReadRecordFromKinesis"
- "Arn"
StartingPosition: "TRIM_HORIZON"