cfn-guardian 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +52 -0
- data/LICENSE.txt +21 -0
- data/README.md +412 -0
- data/Rakefile +2 -0
- data/cfn-guardian.gemspec +39 -0
- data/exe/cfn-guardian +4 -0
- data/lib/cfnguardian.rb +146 -0
- data/lib/cfnguardian/compile.rb +116 -0
- data/lib/cfnguardian/deploy.rb +144 -0
- data/lib/cfnguardian/log.rb +40 -0
- data/lib/cfnguardian/models/alarm.rb +292 -0
- data/lib/cfnguardian/models/check.rb +114 -0
- data/lib/cfnguardian/models/event.rb +192 -0
- data/lib/cfnguardian/resources/amazonmq_broker.rb +45 -0
- data/lib/cfnguardian/resources/apigateway.rb +34 -0
- data/lib/cfnguardian/resources/application_targetgroup.rb +31 -0
- data/lib/cfnguardian/resources/autoscaling_group.rb +22 -0
- data/lib/cfnguardian/resources/base.rb +116 -0
- data/lib/cfnguardian/resources/cloudfront_distribution.rb +26 -0
- data/lib/cfnguardian/resources/domain_expiry.rb +30 -0
- data/lib/cfnguardian/resources/dynamodb_table.rb +48 -0
- data/lib/cfnguardian/resources/ec2_instance.rb +24 -0
- data/lib/cfnguardian/resources/ecs_cluster.rb +44 -0
- data/lib/cfnguardian/resources/ecs_service.rb +32 -0
- data/lib/cfnguardian/resources/elastic_file_system.rb +17 -0
- data/lib/cfnguardian/resources/elastic_loadbalancer.rb +26 -0
- data/lib/cfnguardian/resources/elasticache_replication_group.rb +45 -0
- data/lib/cfnguardian/resources/http.rb +49 -0
- data/lib/cfnguardian/resources/lambda.rb +38 -0
- data/lib/cfnguardian/resources/network_targetgroup.rb +31 -0
- data/lib/cfnguardian/resources/nrpe.rb +42 -0
- data/lib/cfnguardian/resources/rds_cluster_instance.rb +30 -0
- data/lib/cfnguardian/resources/rds_instance.rb +45 -0
- data/lib/cfnguardian/resources/redshift_cluster.rb +30 -0
- data/lib/cfnguardian/resources/sql.rb +37 -0
- data/lib/cfnguardian/resources/sqs_queue.rb +23 -0
- data/lib/cfnguardian/s3.rb +35 -0
- data/lib/cfnguardian/stacks/main.rb +149 -0
- data/lib/cfnguardian/stacks/resources.rb +80 -0
- data/lib/cfnguardian/string.rb +19 -0
- data/lib/cfnguardian/validate.rb +80 -0
- data/lib/cfnguardian/version.rb +4 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2605c1c68bc60955c63d620536adc746e75db45812783c641ee41a85cfc6693b
|
4
|
+
data.tar.gz: 50882bfd8151cc4cde52a0107509a8a9380bc15d8ab6d3805558f8a9578a928e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1134950814ca8e006cac4e5b78a6d0d77e2e3a289e85fac71b981f60fafe0c332eb3f84c44cffa28763c9b5bd093f0e6b385fe19962920a895dcd833fbe81dd4
|
7
|
+
data.tar.gz: ee7616c707777d6fcdcc5d199ef2e821f8678464b4a0292b3ccd9fcd1f30785aa22057b59d39f543b36652b51ac529c65c1c25671cd8409d6892cf0d3fbc796e
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cfn-guardian (0.1.0)
|
5
|
+
aws-sdk-cloudformation (~> 1, < 2)
|
6
|
+
aws-sdk-s3 (~> 1, < 2)
|
7
|
+
cfndsl (~> 1.0, < 2)
|
8
|
+
terminal-table (~> 1, < 2)
|
9
|
+
thor (~> 0.20)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
aws-eventstream (1.0.3)
|
15
|
+
aws-partitions (1.236.0)
|
16
|
+
aws-sdk-cloudformation (1.26.0)
|
17
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
18
|
+
aws-sigv4 (~> 1.1)
|
19
|
+
aws-sdk-core (3.76.0)
|
20
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
21
|
+
aws-partitions (~> 1, >= 1.228.0)
|
22
|
+
aws-sigv4 (~> 1.1)
|
23
|
+
jmespath (~> 1.0)
|
24
|
+
aws-sdk-kms (1.25.0)
|
25
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
26
|
+
aws-sigv4 (~> 1.1)
|
27
|
+
aws-sdk-s3 (1.53.0)
|
28
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
29
|
+
aws-sdk-kms (~> 1)
|
30
|
+
aws-sigv4 (~> 1.1)
|
31
|
+
aws-sigv4 (1.1.0)
|
32
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
33
|
+
cfndsl (1.0.0)
|
34
|
+
hana (~> 1.3)
|
35
|
+
hana (1.3.5)
|
36
|
+
jmespath (1.4.0)
|
37
|
+
rake (10.5.0)
|
38
|
+
terminal-table (1.8.0)
|
39
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
40
|
+
thor (0.20.3)
|
41
|
+
unicode-display_width (1.6.0)
|
42
|
+
|
43
|
+
PLATFORMS
|
44
|
+
ruby
|
45
|
+
|
46
|
+
DEPENDENCIES
|
47
|
+
bundler (~> 2.0)
|
48
|
+
cfn-guardian!
|
49
|
+
rake (~> 10.0)
|
50
|
+
|
51
|
+
BUNDLED WITH
|
52
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Guslington
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,412 @@
|
|
1
|
+
# CfnGuardian
|
2
|
+
|
3
|
+
CfnGuardian is a AWS monitoring tool with a few capabilities:
|
4
|
+
|
5
|
+
- creates cloudwatch alarms through cloudformation based upon resources defined in a YAML config
|
6
|
+
- alerting through SNS using 4 levels of severity [ Critical, Warning, Task, Informational ]
|
7
|
+
- has a standard set of default alarms across many AWS resources
|
8
|
+
- creates custom metrics for external checks through lambda functions such as
|
9
|
+
- http endpoint availability
|
10
|
+
- http status code matching
|
11
|
+
- http body regex matching
|
12
|
+
- domain expiry
|
13
|
+
- ssl expiry
|
14
|
+
- sql query
|
15
|
+
- nrpe
|
16
|
+
|
17
|
+
**Supported AWS Resources**
|
18
|
+
|
19
|
+
- AmazonMq
|
20
|
+
- ApiGateway
|
21
|
+
- Application Targetgroups
|
22
|
+
- Network TargetGroups
|
23
|
+
- AutoScalingGroups
|
24
|
+
- CloudFront Distributions
|
25
|
+
- DynamoDB Tables
|
26
|
+
- EC2 Instances
|
27
|
+
- ECS Clusters
|
28
|
+
- ECS Services
|
29
|
+
- EFS
|
30
|
+
- Classic LoadBalancers
|
31
|
+
- Lambda Functions
|
32
|
+
- RDS Clusters
|
33
|
+
- RDS Instances
|
34
|
+
- Redshift Cluster
|
35
|
+
- SQS Queues
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
gem install cfn-guardian
|
41
|
+
```
|
42
|
+
|
43
|
+
## Commands
|
44
|
+
|
45
|
+
**compile**
|
46
|
+
|
47
|
+
```bash
|
48
|
+
Usage:
|
49
|
+
cfn-guardian compile c, --config=CONFIG
|
50
|
+
|
51
|
+
Options:
|
52
|
+
c, --config=CONFIG # yaml config file
|
53
|
+
[--validate], [--no-validate] # validate cfn templates
|
54
|
+
# Default: true
|
55
|
+
[--bucket=BUCKET] # provide custom bucket name, will create a default bucket if not provided
|
56
|
+
r, [--region=REGION] # set the AWS region
|
57
|
+
|
58
|
+
Description:
|
59
|
+
Generates CloudFormation templates from the alarm configuration and output to the out/ directory.
|
60
|
+
```
|
61
|
+
|
62
|
+
**deploy**
|
63
|
+
|
64
|
+
```bash
|
65
|
+
Usage:
|
66
|
+
cfn-guardian deploy c, --config=CONFIG
|
67
|
+
|
68
|
+
Options:
|
69
|
+
c, --config=CONFIG # yaml config file
|
70
|
+
[--bucket=BUCKET] # provide custom bucket name, will create a default bucket if not provided
|
71
|
+
r, [--region=REGION] # set the AWS region
|
72
|
+
r, [--stack-name=STACK_NAME] # set the Cloudformation stack name. Defaults to `guardian`
|
73
|
+
[--sns-critical=SNS_CRITICAL] # sns topic arn for the critical alamrs
|
74
|
+
[--sns-warning=SNS_WARNING] # sns topic arn for the warning alamrs
|
75
|
+
[--sns-task=SNS_TASK] # sns topic arn for the task alamrs
|
76
|
+
[--sns-informational=SNS_INFORMATIONAL] # sns topic arn for the informational alamrs
|
77
|
+
|
78
|
+
Description:
|
79
|
+
Generates CloudFormation templates from the alarm configuration and output to the out/ directory. Then copies the files to the s3 bucket and deploys the cloudformation.
|
80
|
+
```
|
81
|
+
|
82
|
+
**show-alarms**
|
83
|
+
|
84
|
+
```bash
|
85
|
+
Usage:
|
86
|
+
cfn-guardian show-alarms c, --config=CONFIG
|
87
|
+
|
88
|
+
Options:
|
89
|
+
c, --config=CONFIG # yaml config file
|
90
|
+
g, [--group=GROUP] # resource group
|
91
|
+
n, [--name=NAME] # alarm name
|
92
|
+
r, [--resource=RESOURCE] # resource id
|
93
|
+
|
94
|
+
Description:
|
95
|
+
Displays the configured settings for each alarm. Can be filtered by resource group, resource name and alarm name. Defaults to show all configured alarms.
|
96
|
+
```
|
97
|
+
|
98
|
+
```bash
|
99
|
+
ECSCluster
|
100
|
+
+--------------------------------------+-----------------------------------+
|
101
|
+
| ECSContianerInstancesDisconnected |
|
102
|
+
+--------------------------------------+-----------------------------------+
|
103
|
+
| property | Value |
|
104
|
+
+--------------------------------------+-----------------------------------+
|
105
|
+
| actions_enabled | true |
|
106
|
+
| alarm_action | Critical |
|
107
|
+
| comparison_operator | GreaterThanThreshold |
|
108
|
+
| datapoints_to_alarm | |
|
109
|
+
| dimensions | {:ClusterName=>"MyCluster"} |
|
110
|
+
| enabled | true |
|
111
|
+
| evaluate_low_sample_count_percentile | |
|
112
|
+
| evaluation_periods | 2 |
|
113
|
+
| extended_statistic | |
|
114
|
+
| metric_name | ECSContianerInstancesDisconnected |
|
115
|
+
| namespace | EcsCICheck |
|
116
|
+
| period | 300 |
|
117
|
+
| resource | MyCluster |
|
118
|
+
| resource_name | 3ccc504543e67a86f3fa43bb64cf592b |
|
119
|
+
| statistic | Maximum |
|
120
|
+
| threshold | 0 |
|
121
|
+
| treat_missing_data | |
|
122
|
+
| unit | |
|
123
|
+
+--------------------------------------+-----------------------------------+
|
124
|
+
```
|
125
|
+
|
126
|
+
## Configuration
|
127
|
+
|
128
|
+
Config is stored in a standard YAML file which will default to `alarms.yaml`. This can be overridden by supplying the `--config` switch.
|
129
|
+
|
130
|
+
### AWS Resources
|
131
|
+
|
132
|
+
The resources key is where the resources are defined.
|
133
|
+
|
134
|
+
```yaml
|
135
|
+
Resources:
|
136
|
+
# resource group
|
137
|
+
Ec2Instance:
|
138
|
+
# Array of resources defining the resource id with the Id: key
|
139
|
+
- Id: i-1a2b3c4d5e
|
140
|
+
```
|
141
|
+
|
142
|
+
There are some resources that require more that the resource id to generate the alarm, for these cases addition key:values are required.
|
143
|
+
|
144
|
+
```yaml
|
145
|
+
Resources:
|
146
|
+
ApplicationTargetGroup:
|
147
|
+
- Id: target-group-id
|
148
|
+
# Target group requires the loadbalancer id for the alarm
|
149
|
+
Loadbalancer: app/application-loadbalancer-id
|
150
|
+
```
|
151
|
+
|
152
|
+
| Resource Group | Require Keys |
|
153
|
+
| --------------------------- | ---------------- |
|
154
|
+
| ApiGateway | Id |
|
155
|
+
| AmazonMQBroker | Id |
|
156
|
+
| AutoScalingGroup | Id |
|
157
|
+
| DynamoDBTable | Id |
|
158
|
+
| ElastiCacheReplicationGroup | Id |
|
159
|
+
| ElasticFileSystem | Id |
|
160
|
+
| Ec2Instance | Id |
|
161
|
+
| EcsCluster | Id |
|
162
|
+
| EcsService | Id, Cluster |
|
163
|
+
| NetworkTargetGroup | Id, LoadBalancer |
|
164
|
+
| ApplicationTargetGroup | Id, LoadBalancer |
|
165
|
+
| ElasticLoadBalancer | Id |
|
166
|
+
| RDSInstance | Id |
|
167
|
+
| RDSClusterInstance | Id |
|
168
|
+
| RedshiftCluster | Id |
|
169
|
+
| Lambda | Id |
|
170
|
+
| CloudFrontDistribution | Id |
|
171
|
+
| SQSQueue | Id |
|
172
|
+
|
173
|
+
### Custom Metric Resources
|
174
|
+
|
175
|
+
These are also defined under the resources key but more detail is required and differs per group.
|
176
|
+
|
177
|
+
**Http**
|
178
|
+
|
179
|
+
Cloudwatch NameSpace: `HttpCheck`
|
180
|
+
|
181
|
+
```yaml
|
182
|
+
Resources:
|
183
|
+
Http:
|
184
|
+
# Array of resources defining the http endpoint with the Id: key
|
185
|
+
- Id: https://api.example.com
|
186
|
+
# enables the status code check
|
187
|
+
StatusCode: 200
|
188
|
+
# enables the SSL check
|
189
|
+
Ssl: true
|
190
|
+
- Id: https://www.example.com
|
191
|
+
StatusCode: 301
|
192
|
+
- Id: https://example.com
|
193
|
+
StatusCode: 200
|
194
|
+
Ssl: true
|
195
|
+
# enables the body regex check
|
196
|
+
BodyRegex: 'helloworld'
|
197
|
+
```
|
198
|
+
|
199
|
+
**DomainExpiry**
|
200
|
+
|
201
|
+
Cloudwatch NameSpace: `DNS`
|
202
|
+
|
203
|
+
```yaml
|
204
|
+
Resources:
|
205
|
+
DomainExpiry:
|
206
|
+
# Array of resources defining the domain with the Id: key
|
207
|
+
- Id: example.com
|
208
|
+
```
|
209
|
+
|
210
|
+
**Nrpe**
|
211
|
+
|
212
|
+
Cloudwatch NameSpace: `NRPE`
|
213
|
+
|
214
|
+
*Note: This requires the nrpe agent running and configured on your EC2 Host*
|
215
|
+
|
216
|
+
```yaml
|
217
|
+
Resources:
|
218
|
+
Nrpe:
|
219
|
+
# Array of host groups with the uniq identifier of Environment.
|
220
|
+
# This will create a nrpe lambda per group attach to the defined vpc and subnets
|
221
|
+
- Environment: Prod
|
222
|
+
# VPC id for the vpc the EC2 hosts are running in
|
223
|
+
VpcId: vpc-1234
|
224
|
+
# Array of subnets to attach to the lambda function. Supply multiple if you want to be multi AZ.
|
225
|
+
# Multiple subnets from the same AZ cannot be used!
|
226
|
+
Subnets:
|
227
|
+
- subnet-abcd
|
228
|
+
Hosts:
|
229
|
+
# Array of hosts with the Id: key defining the host private ip address
|
230
|
+
- Id: 10.150.10.6
|
231
|
+
# Array of nrpe commands to run against the host.
|
232
|
+
# A custom metric and alarm is created for each command
|
233
|
+
Commands:
|
234
|
+
- check_disk
|
235
|
+
- Id: 10.150.10.6
|
236
|
+
Commands:
|
237
|
+
- check_disk
|
238
|
+
```
|
239
|
+
|
240
|
+
**Sql**
|
241
|
+
|
242
|
+
Cloudwatch NameSpace: `SQL`
|
243
|
+
|
244
|
+
```yaml
|
245
|
+
Resources:
|
246
|
+
Sql:
|
247
|
+
# Array of host groups with the uniq identifier of Environment.
|
248
|
+
# This will create a sql lambda per group attach to the defined vpc and subnets
|
249
|
+
- Environment: Prod
|
250
|
+
# VPC id for the vpc the EC2 hosts are running in
|
251
|
+
VpcId: vpc-1234
|
252
|
+
# Array of subnets to attach to the lambda function. Supply multiple if you want to be multi AZ.
|
253
|
+
# Multiple subnets from the same AZ cannot be used!
|
254
|
+
Subnets:
|
255
|
+
- subnet-1234
|
256
|
+
Hosts:
|
257
|
+
# Array of hosts with the Id: key defining the host private ip address
|
258
|
+
- Id: my-rds-instance.example.com
|
259
|
+
# Secret manager secret where the sql:// connection string key:value is defined
|
260
|
+
# { "connectionString": "sql://username:password@mydb:3306/information_schema"}
|
261
|
+
SecretId: MyTestDatabaseSecret
|
262
|
+
# Database engine. supports mysql | postgres | mssql
|
263
|
+
Engine: mysql
|
264
|
+
Queries:
|
265
|
+
# Array of SQL queries
|
266
|
+
# MetricName used to create the custom metric and alarm
|
267
|
+
- MetricName: LongRunningTransactions
|
268
|
+
# SQL Query to execute
|
269
|
+
Query: >-
|
270
|
+
SELECT pl.host,trx_id,trx_started,trx_query
|
271
|
+
FROM information_schema.INNODB_TRX it INNER
|
272
|
+
JOIN information_schema.PROCESSLIST pl
|
273
|
+
ON pl.Id=it.trx_mysql_thread_id
|
274
|
+
WHERE it.trx_started < (NOW() - INTERVAL 4 HOUR);
|
275
|
+
```
|
276
|
+
|
277
|
+
Create secretmanager secret:
|
278
|
+
|
279
|
+
```bash
|
280
|
+
aws secretsmanager create-secret --name MyTestDatabaseSecret \
|
281
|
+
--description "My test database secret for use with guardian sql check" \
|
282
|
+
--secret-string '{"connectionString":"sql://username:password@mydb:3306/information_schema"}'
|
283
|
+
```
|
284
|
+
|
285
|
+
## Alarm Templates
|
286
|
+
|
287
|
+
Each resource group has a set of default alarm templates which defines all the cloudwatch alarm options such as Threshold, Statistic, EvaluationPeriods etc. These can be manipulated in a few ways to change the values or create new alarms.
|
288
|
+
|
289
|
+
Custom alarm templates are defined within the same YAML config file un the `Templates` key.
|
290
|
+
|
291
|
+
### Overriding Defaults
|
292
|
+
|
293
|
+
```yaml
|
294
|
+
Templates:
|
295
|
+
# define the resource group
|
296
|
+
Ec2Instance:
|
297
|
+
# define the Alarm name you want to override
|
298
|
+
CPUUtilizationHigh:
|
299
|
+
# supply the key value of the alarm property you want to override
|
300
|
+
Threshold: 80
|
301
|
+
```
|
302
|
+
|
303
|
+
### Creating A New Alarm From A Default
|
304
|
+
|
305
|
+
You can create a default alarm from a default alarm using the `Inherit:` key. This will inherit all properites from the default alarm which can then be overridden.
|
306
|
+
|
307
|
+
```yaml
|
308
|
+
Templates:
|
309
|
+
# define the resource group
|
310
|
+
Ec2Instance:
|
311
|
+
# define the Alarm name you want to override
|
312
|
+
CPUUtilizationWarning:
|
313
|
+
# Inherit the CPUUtilizationHigh alarm
|
314
|
+
Inherit: CPUUtilizationHigh
|
315
|
+
# supply the key value of the alarm property you want to override
|
316
|
+
Threshold: 75
|
317
|
+
EvaluationPeriods: 60
|
318
|
+
AlarmAction: Warning
|
319
|
+
```
|
320
|
+
|
321
|
+
### Creating A New Alarm With No Defaults
|
322
|
+
|
323
|
+
You can create a new alarm with out inheriting an existing one. This will the inherit the default properties for the resource group.
|
324
|
+
|
325
|
+
```yaml
|
326
|
+
Templates:
|
327
|
+
# define the resource group
|
328
|
+
Ec2Instance:
|
329
|
+
# define the Alarm name you want to override
|
330
|
+
CPUUtilizationWarning:
|
331
|
+
# metric name must be provided
|
332
|
+
MetricName: CPUUtilization
|
333
|
+
# supply the key value of the alarm property you want to override
|
334
|
+
Statistic: Minimum
|
335
|
+
Threshold: 75
|
336
|
+
EvaluationPeriods: 60
|
337
|
+
AlarmAction: Warning
|
338
|
+
```
|
339
|
+
|
340
|
+
### Disabling An Alarm
|
341
|
+
|
342
|
+
You can disable an alarm by setting the alarm to `false`
|
343
|
+
|
344
|
+
```yaml
|
345
|
+
Templates:
|
346
|
+
# define the resource group
|
347
|
+
Ec2Instance:
|
348
|
+
# define the Alarm and set the value to false
|
349
|
+
CPUUtilizationHigh: false
|
350
|
+
```
|
351
|
+
|
352
|
+
### Creating A New Resource Group
|
353
|
+
|
354
|
+
You can create a new resource group based upon an existing resource group. For example if you had 2 target groups and wanted to disable an alarm for one but not the other you can create a new resource group which will inherit all the ApplicationTargetGroup alarms and the disabled the select alarm.
|
355
|
+
|
356
|
+
```yaml
|
357
|
+
Resources:
|
358
|
+
# the default resource group
|
359
|
+
ApplicationTargetGroup:
|
360
|
+
- Id: ApiTG
|
361
|
+
LoadBalancer: MyPublicLB
|
362
|
+
- Id: WebTG
|
363
|
+
LoadBalancer: MyPublicLB
|
364
|
+
- Id: ServiceTG
|
365
|
+
LoadBalancer: MyPublicLB
|
366
|
+
|
367
|
+
# my new custom resource group
|
368
|
+
RedirectTargetGroup:
|
369
|
+
- Id: RedirectTG
|
370
|
+
LoadBalancer: MyPublicLB
|
371
|
+
|
372
|
+
Templates:
|
373
|
+
# create the new resource group
|
374
|
+
RedirectTargetGroup:
|
375
|
+
# inherit the ApplicationTargetGroup resource group
|
376
|
+
Inherit: ApplicationTargetGroup
|
377
|
+
# disable the selected alarm
|
378
|
+
TargetResponseTime: false
|
379
|
+
```
|
380
|
+
|
381
|
+
## SNS Topics
|
382
|
+
|
383
|
+
Create the topics before launching the guardian stack
|
384
|
+
|
385
|
+
```bash
|
386
|
+
aws sns create-topic --name Guardian-Critical
|
387
|
+
aws sns create-topic --name Guardian-Warning
|
388
|
+
aws sns create-topic --name Guardian-Task
|
389
|
+
aws sns create-topic --name Guardian-Informational
|
390
|
+
```
|
391
|
+
|
392
|
+
SNS topics can be defined in the YAML config or during the `deploy` command using the sns switches. The full ARN must be used.
|
393
|
+
|
394
|
+
```yaml
|
395
|
+
Topics:
|
396
|
+
Critical: arn:aws:sns:ap-southeast-2:111111111111:Guardian-Critical
|
397
|
+
Warning: arn:aws:sns:ap-southeast-2:111111111111:Guardian-Warning
|
398
|
+
Task: arn:aws:sns:ap-southeast-2:111111111111:Guardian-Task
|
399
|
+
Informational: arn:aws:sns:ap-southeast-2:111111111111:Guardian-Informational
|
400
|
+
```
|
401
|
+
|
402
|
+
## Severities
|
403
|
+
|
404
|
+
Severties are defined in each alarm sing the `AlarmAction` key. There are 4 options `[ Critical, Warning, Task, Informational ]`
|
405
|
+
|
406
|
+
## Contributing
|
407
|
+
|
408
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/base2services/cfn-guardian.
|
409
|
+
|
410
|
+
## License
|
411
|
+
|
412
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|