-
Notifications
You must be signed in to change notification settings - Fork 7
/
template.yaml
111 lines (103 loc) · 3.61 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
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
aws-eventbridge-user-presence-update-blueprint
Metadata:
AWS::ServerlessRepo::Application:
Name: aws-eventbridge-user-presence-update-blueprint
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Genesys EventBridge Integration Solution
Parameters:
- EventSourceName
ParameterLabels:
EventSourceName:
default: Event Source Name
Parameters:
EventSourceName:
Type: String
AllowedPattern: aws\.partner(/[\.\-_A-Za-z0-9]+){2,}
MinLength: 1
MaxLength: 256
Description: Name of the Amazon EventBridge SaaS Partner Event Source to associate with an Event Bus. For example, aws.partner/example.com/1234567890/test-event-source.
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Resources:
EventBridgeFunctionPython:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: src/python
Handler: app.lambda_handler
Runtime: python3.8
Timeout: 10
Events:
EventBridgeRule:
Type: EventBridgeRule
Properties:
Pattern:
account:
- !Ref AWS::AccountId
EventBusName: !Ref EventBridgeEventBus
Policies:
- DynamoDBCrudPolicy:
TableName: eb_user_presence
EventBridgeFunctionNode:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/typescript
Handler: dist/app.lambdaHandler
Runtime: nodejs14.x
Timeout: 10
Events:
EventBridgeRule:
Type: EventBridgeRule
Properties:
Pattern:
account:
- !Ref AWS::AccountId
EventBusName: !Ref EventBridgeEventBus
Policies:
- DynamoDBCrudPolicy:
TableName: eb_user_presence
EventBridgeEventBus:
Type: AWS::Events::EventBus
Properties:
EventSourceName: !Ref EventSourceName
Name: !Ref EventSourceName
EventBridgeUserPresenceTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: eb_user_presence
AttributeDefinitions:
- AttributeName: user_id
AttributeType: S
KeySchema:
- AttributeName: user_id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
Outputs:
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#eventbridgerule
EventBridgeRulePython:
Description: "EventBridge Rule Python ARN"
Value: !GetAtt EventBridgeFunctionPythonEventBridgeRule.Arn
EventBridgeRuleNode:
Description: "EventBridge Rule Node ARN"
Value: !GetAtt EventBridgeFunctionNodeEventBridgeRule.Arn
EventBridgeFunctionPython:
Description: "EventBridge Lambda Function Python ARN"
Value: !GetAtt EventBridgeFunctionPython.Arn
EventBridgeFunctionNode:
Description: "EventBridge Lambda Function Node ARN"
Value: !GetAtt EventBridgeFunctionNode.Arn
EventBridgeFunctionIamRolePython:
Description: "Implicit IAM Role created for EventBridge Python function"
Value: !GetAtt EventBridgeFunctionPython.Arn
EventBridgeFunctionIamRoleNode:
Description: "Implicit IAM Role created for EventBridge Node function"
Value: !GetAtt EventBridgeFunctionNode.Arn