-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
59 lines (54 loc) · 1.62 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: <Lambda Function Description>
Globals:
Function:
Timeout: 10
MemorySize: 128
Parameters:
NotificationTopicArn:
Type: String
Default: "arn:aws:sns:eu-central-1:420422022241:LambdaAlertTopic"
Resources:
LambdaExecRoles:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Path: /
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
<Function name>: # The name should be in camel case. E.g., HelloWorldFunction
Type: AWS::Serverless::Function
Properties:
Handler: app.lambda_handler
CodeUri: src/
Runtime: python3.11
FunctionName: lake-<Function name> # The name is used for invocation and it should be in kebab case. E.g., lake-hello-world
Role:
Fn::GetAtt:
- LambdaExecRoles
- Arn
<Function name>Alert: # The name should be in camel case. E.g., HelloWorldFunctionAlert
Type: AWS::CloudWatch::Alarm
Properties:
AlarmActions:
- !Ref NotificationTopicArn
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: FunctionName
Value: !Ref <Function name> # E.g., HelloWorldFunction
EvaluationPeriods: 1
MetricName: Errors
Namespace: AWS/Lambda
Period: 300
Statistic: Sum
Threshold: 0
TreatMissingData: ignore