-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yml
More file actions
83 lines (80 loc) · 3.02 KB
/
template.yml
File metadata and controls
83 lines (80 loc) · 3.02 KB
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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: A collection of utilities that integrate with Statuspage
Parameters:
CrossAccountSharingRoleName:
{ Type: String, Default: CloudWatch-CrossAccountSharingRole }
StatuspageApiKey: { Type: String }
Resources:
MetricsShipperFunction:
Type: AWS::Serverless::Function
Properties:
Architectures: [arm64]
CodeUri: src/metrics-shipper
Description: >-
Fetches various metrics from CloudWatch and sends them to Statuspage
as system metrics
Environment:
Variables:
STATUSPAGE_API_KEY: !Ref StatuspageApiKey
CLOUD_WATCH_SHARING_ROLE_NAME: !Ref CrossAccountSharingRoleName
Events:
Cron:
Properties:
Description: Ships metrics to Statuspage
Schedule: rate(3 minutes)
State: ENABLED
Type: Schedule
Handler: index.handler
MemorySize: 129
Policies:
- Statement:
- Action: sts:AssumeRole
Effect: Allow
Resource: !Sub arn:aws:iam::*:role/${CrossAccountSharingRoleName}
Version: "2012-10-17"
Runtime: nodejs24.x
Tags:
prx:meta:tagging-version: "2021-04-07"
prx:cloudformation:stack-name: !Ref AWS::StackName
prx:cloudformation:stack-id: !Ref AWS::StackId
prx:ops:environment: Production
prx:dev:application: Statuspage Toolkit
Timeout: 30
MetricsShipperLogGroup:
Type: AWS::Logs::LogGroup
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Properties:
LogGroupName: !Sub /aws/lambda/${MetricsShipperFunction}
RetentionInDays: 5
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:ops:environment, Value: Production }
- { Key: prx:dev:application, Value: Statuspage Toolkit }
MetricsShipperErrorAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: !Sub WARN [Statuspage] Metrics shipper <prod> FUNCTION ERRORS (${AWS::StackName})
AlarmDescription: >-
The Lambda function that ships metrics from CloudWatch to Statuspage
failing, so system metrics on the PRX status page may be incorrect.
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: FunctionName
Value: !Ref MetricsShipperFunction
EvaluationPeriods: 1
MetricName: Errors
Namespace: AWS/Lambda
Period: 60
Statistic: Sum
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:ops:environment, Value: Production }
- { Key: prx:dev:application, Value: Statuspage Toolkit }
Threshold: 1
TreatMissingData: notBreaching