This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate.yml
96 lines (94 loc) · 2.77 KB
/
template.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
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Perform healthchecks on private IP or private FQDN (Private Route53). Healthchecks status are pushed to Cloudwatch custom metrics.
Parameters:
Protocol:
Type: String
AllowedValues:
- http
- https
Default: http
Description: 'Protocol of the URL to test (http or https). Default: http'
Hostname:
Type: String
Description: 'Hostname or IP of the URL to test. Default: localhost'
Port:
Type: Number
Default: 80
Description: 'Port of URL to test. Default: 80 for http, 443 for https'
UrlPath:
Type: String
Description: 'Path of the URL to test. Default: no path'
StringMatching:
Type: String
Description: '(Optional) String to search in the response body. If found the healcheck will succeed.'
InvertHealtcheckStatus:
Type: String
Default: false
Description: '(Optional) Set to true if you want to invert the healthcheck result'
MetricName:
Type: String
Default: MyService
Description: 'Name of the Cloudwatch metrics. Default: MyService'
MetricNamespace:
Type: String
Default: HealthCheck
Description: 'Namespace of the Cloudwatch Metric. Default: HealthCheck'
Cron:
Type: String
Default: 0/5 * * * ? *
Description: 'Cron expression (example : "0/5 * * * ? *" : run healthchecks every 5 minutes )'
SecurityGroupIds:
Type: List<String>
SubnetIds:
Type: List<String>
Timeout:
Type: Number
Default: 10
Description: 'Timeout in Seconds'
Resources:
AwsInternalHealthcheck:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs8.10
Description: >-
Perform healthchecks on private IP or private FQDN (Private Route53).
Healthchecks status are pushed to Cloudwatch custom metrics.
Timeout: 30
Policies:
- CloudWatchPutMetricPolicy: {}
- VPCAccessPolicy: {}
VpcConfig:
SecurityGroupIds: !Ref SecurityGroupIds
SubnetIds: !Ref SubnetIds
Environment:
Variables:
PROTOCOL:
Ref: Protocol
HOSTNAME:
Ref: Hostname
PORT:
Ref: Port
URL_PATH:
Ref: UrlPath
STRING_MATCHING:
Ref: StringMatching
INVERT_HEALTHCHECK_STATUS:
Ref: InvertHealtcheckStatus
METRIC_NAME:
Ref: MetricName
METRIC_NAMESPACE:
Ref: MetricNamespace
TIMEOUT:
Ref: Timeout
Events:
Timer:
Type: Schedule
Properties:
Schedule:
'Fn::Join':
- ''
- - 'cron('
- !Ref Cron
- ')'