-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
62 lines (56 loc) · 1.52 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
eventbridge-lambda
Sample SAM Template for eventbridge-lambda
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.lambda_handler
Runtime: python3.13
CodeUri: hello_world/
Policies:
- CloudWatchLogsFullAccess
Events:
EventBridgeRule:
Type: CloudWatchEvent
Properties:
Pattern:
source:
- "custom.myapp"
detail-type:
- "MyApp Event"
detail:
status:
- "trigger"
EventBridgeRule:
Type: AWS::Events::Rule
Properties:
Name: MyEventBridgeRule
EventPattern:
source:
- "custom.myapp"
detail-type:
- "MyApp Event"
detail:
status:
- "trigger"
Targets:
- Arn: !GetAtt HelloWorldFunction.Arn
Id: "HelloWorldFunctionTarget"
LambdaInvokePermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName: !GetAtt HelloWorldFunction.Arn
Principal: events.amazonaws.com
SourceArn: !GetAtt EventBridgeRule.Arn
Outputs:
HelloWorldFunction:
Description: Lambda Function ARN
Value: !GetAtt HelloWorldFunction.Arn