forked from epsagon/clear-lambda-storage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
58 lines (54 loc) · 1.48 KB
/
serverless.yml
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
service: clear-lambda-storage
frameworkVersion: '3'
provider:
name: aws
stage: ${opt:stage, 'dev'}
runtime: python3.10
versionFunctions: false
region: ${opt:region, 'us-east-1'}
iamRoleStatements:
- Effect: "Allow"
Action:
- lambda:List*
- lambda:DeleteFunction
Resource: "*"
package:
exclude:
- .git/**
- node_modules/**
- __pycache__/**
- package-lock.json
- package.json
- README.srt
functions:
clearLambdaStorage:
handler: handler.clear_lambda_storage
memorySize: 512
timeout: 900
events:
## Schedule: Every other hour
- schedule:
method: scheduler
rate: cron(0 */2 * * ? *)
timezone: America/New_York
resources:
Resources:
ClearLambdaStorageAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: !Sub 'Alarms when the ${AWS::StackName} clear_lambda_storage Lambda errors'
AlarmName: !Sub '${AWS::StackName}-clear-lambda-storage-alarm'
AlarmActions:
- !ImportValue hellotill-platform-alarms-production:IntegrationsLowPriorityAlarmTopicArn
Namespace: AWS/Lambda
ComparisonOperator: GreaterThanThreshold
DatapointsToAlarm: 1
EvaluationPeriods: 1
Period: 60
Statistic: Sum
Threshold: 0
TreatMissingData: notBreaching
MetricName: Errors
Dimensions:
- Name: FunctionName
Value: !Ref ClearLambdaStorageLambdaFunction