-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathterraform.example.tfvars
1296 lines (1283 loc) · 54.2 KB
/
terraform.example.tfvars
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#--------------------------------------------------------------
# Basically, it is already set so that the setting is completed only by changing tfvars.
# All parameters that need to be changed for each environment are described in TODO comments.
#--------------------------------------------------------------
#--------------------------------------------------------------
# Deploy IAM user
#--------------------------------------------------------------
# TODO: need to change deploy IAM user.
deploy_user = "terraform"
#--------------------------------------------------------------
# Default Tags for Resources
# A tag that is set globally for the resources used.
#--------------------------------------------------------------
# TODO: need to change tags.
tags = {
# TODO: need to change env.
env = "dev"
# TODO: need to change service.
# service is project name or job name or product name.
service = "base"
}
#--------------------------------------------------------------
# Name prefix
# It is used as a prefix attached to various resource names.
#--------------------------------------------------------------
name_prefix = "base-"
#--------------------------------------------------------------
# Default Tags for Resources
#--------------------------------------------------------------
# TODO: need to change region.
region = "ap-northeast-1"
#--------------------------------------------------------------
# Common:Log Bucket
#--------------------------------------------------------------
common_log = {
#--------------------------------------------------------------
# S3 for application log
# https://registry.terraform.io/modules/terraform-aws-modules/s3-bucket/aws/latest
#--------------------------------------------------------------
s3_application_log = {
bucket = "aws-log-application"
create_bucket = true
acl = "log-delivery-write"
attach_deny_insecure_transport_policy = true
attach_elb_log_delivery_policy = false
attach_lb_log_delivery_policy = false
attach_policy = false
attach_public_policy = true
attach_require_latest_tls_policy = true
block_public_acls = true
block_public_policy = true
force_destroy = true
ignore_public_acls = true
lifecycle_rule = [
{
id = "default"
abort_incomplete_multipart_upload_days = 7
enabled = true
prefix = null
expiration = [
{
# TODO: need to change days. default 3years.
days = 1095
expired_object_delete_marker = false
}
]
transition = [
{
days = 30
storage_class = "ONEZONE_IA"
}
]
noncurrent_version_expiration = [
{
days = 30
}
]
}
]
# TODO: need to change for logging.
# example)
# logging = {
# target_bucket = "{your bucket}"
# target_prefix = "AccessLogs/{your account id}/{your bucket}/"
# }
logging = {}
restrict_public_buckets = true
server_side_encryption_configuration = {
rule = {
apply_server_side_encryption_by_default = {
sse_algorithm = "AES256"
kms_master_key_id = null
}
}
}
versioning = {
enabled = true
}
}
}
#--------------------------------------------------------------
# Common: settings for notifying metrics
#--------------------------------------------------------------
common_lambda = {
vpc = {
# TODO: If you want to run LambdaFunctions inside a VPC, set to true. However,
# VPC requires more cost since you need to configure NAT Gateway and other settings.
is_enabled = false
# TODO: If a VPC has already been established, specify false; if a new VPC is to be created, specify true.
create_vpc = false
# TODO: To specify a VPC that already exists, configure the following settings for Lambda.
# If var.common_lambda.vpc.is_enabled = true and var.common_lambda.vpc.create_vpc = false,
# the Lambda will be built in an existing VPC by referencing the parameters here.
exsits = {
private_subnets = [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-xxxxxxxxxxxxxxxxx",
]
security_group_id = "sg-xxxxxxxxxxxxxxxxx"
private_subnets_us_east_1 = [
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-xxxxxxxxxxxxxxxxx",
"subnet-xxxxxxxxxxxxxxxxx",
]
security_group_id_us_east_1 = "sg-xxxxxxxxxxxxxxxxx"
}
# TODO: To specify a new VPC to be set up for Lambda, please set the following information.
# If var.common_lambda.vpc.is_enabled = true and var.common_lambda.vpc.create_vpc = true,
# a new VPC is built by referencing the parameters here.
new = {
name = "vpc-lambda"
cidr = "10.0.0.0/16"
azs = [
"ap-northeast-1a",
"ap-northeast-1c",
"ap-northeast-1d",
]
azs_us_east_1 = [
"us-east-1a",
"us-east-1b",
"us-east-1c",
]
private_subnets = [
"10.0.1.0/24",
"10.0.2.0/24",
"10.0.3.0/24"
]
public_subnets = [
"10.0.101.0/24",
"10.0.102.0/24",
"10.0.103.0/24"
]
enable_dns_support = true
enable_dns_hostnames = true
# No NAT Gateway(private subnet can't access internet.)
# enable_nat_gateway = false
# single_nat_gateway = false
# one_nat_gateway_per_az = false
# One NAT Gateway per subnet (default behavior)
enable_nat_gateway = true
single_nat_gateway = false
one_nat_gateway_per_az = false
# VPN Gateway
enable_vpn_gateway = false
# Flow Log(plain-text or parquet)
enable_flow_log = true
create_flow_log_cloudwatch_log_group = true
create_flow_log_cloudwatch_iam_role = true
flow_log_cloudwatch_log_group_retention_in_days = 14
flow_log_file_format = "plain-text"
}
}
metric = {
aws_kms_key = {
description = "This key used for SNS(for Metrics)."
deletion_window_in_days = 7
is_enabled = true
enable_key_rotation = true
alias_name = "sns-lambda-metric"
}
aws_sns_topic = {
name = "aws-metric"
name_prefix = null
display_name = null
policy = null
delivery_policy = null
application_success_feedback_role_arn = null
application_success_feedback_sample_rate = null
application_failure_feedback_role_arn = null
http_success_feedback_role_arn = null
http_success_feedback_sample_rate = null
http_failure_feedback_role_arn = null
lambda_success_feedback_role_arn = null
lambda_success_feedback_sample_rate = null
lambda_failure_feedback_role_arn = null
sqs_success_feedback_role_arn = null
sqs_success_feedback_sample_rate = null
sqs_failure_feedback_role_arn = null
}
aws_lambda_function = {
environment = {
# TODO: need to change SLACK_OAUTH_ACCESS_TOKEN.(bot token xoxb-xxxxxx....)
SLACK_OAUTH_ACCESS_TOKEN = "xxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
# TODO: need to change SLACK_CHANNEL_ID.
SLACK_CHANNEL_ID = "XXXXXXXXXXXXXX"
LOGGER_FORMATTER = "json"
LOGGER_OUT = "stdout"
LOGGER_LEVEL = "warn"
}
}
}
log = {
aws_kms_key = {
description = "This key used for SNS(for Log)."
deletion_window_in_days = 7
is_enabled = true
enable_key_rotation = true
alias_name = "sns-lambda-log"
}
aws_sns_topic = {
name = "aws-log"
name_prefix = null
display_name = null
policy = null
delivery_policy = null
application_success_feedback_role_arn = null
application_success_feedback_sample_rate = null
application_failure_feedback_role_arn = null
http_success_feedback_role_arn = null
http_success_feedback_sample_rate = null
http_failure_feedback_role_arn = null
lambda_success_feedback_role_arn = null
lambda_success_feedback_sample_rate = null
lambda_failure_feedback_role_arn = null
sqs_success_feedback_role_arn = null
sqs_success_feedback_sample_rate = null
sqs_failure_feedback_role_arn = null
}
aws_lambda_function = {
environment = {
# TODO: need to change SLACK_OAUTH_ACCESS_TOKEN.(bot token xoxb-xxxxxx....)
SLACK_OAUTH_ACCESS_TOKEN = "xxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
# TODO: need to change SLACK_CHANNEL_ID.
SLACK_CHANNEL_ID = "XXXXXXXXXXXXXX"
LOGGER_FORMATTER = "json"
LOGGER_OUT = "stdout"
LOGGER_LEVEL = "warn"
}
}
}
ses = {
aws_kms_key = {
description = "This key used for SNS(for SES)."
deletion_window_in_days = 7
is_enabled = true
enable_key_rotation = true
alias_name = "sns-lambda-ses"
}
aws_sns_topic = {
name = "aws-ses"
name_prefix = null
display_name = null
policy = null
delivery_policy = null
application_success_feedback_role_arn = null
application_success_feedback_sample_rate = null
application_failure_feedback_role_arn = null
http_success_feedback_role_arn = null
http_success_feedback_sample_rate = null
http_failure_feedback_role_arn = null
lambda_success_feedback_role_arn = null
lambda_success_feedback_sample_rate = null
lambda_failure_feedback_role_arn = null
sqs_success_feedback_role_arn = null
sqs_success_feedback_sample_rate = null
sqs_failure_feedback_role_arn = null
}
aws_lambda_function = {
environment = {
# TODO: need to change SLACK_OAUTH_ACCESS_TOKEN.(bot token xoxb-xxxxxx....)
SLACK_OAUTH_ACCESS_TOKEN = "xxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
# TODO: need to change SLACK_CHANNEL_ID.
SLACK_CHANNEL_ID = "XXXXXXXXXXXXXX"
LOGGER_FORMATTER = "json"
LOGGER_OUT = "stdout"
LOGGER_LEVEL = "warn"
LOG_GROUP_NAME = "/aws/ses/log"
LOG_GROUP_RETENTION_IN_DAYS = 14
}
}
}
aws_iam_role = {
description = null
name = "monitor-lambda-role"
path = "/"
}
aws_iam_policy = {
description = null
name = "monitor-lambda-policy"
path = "/"
}
aws_cloudwatch_log_group_lambda = {
# TODO: need to change retention_in_days for each services.
retention_in_days = 14
kms_key_id = null
}
aws_sns_topic_subscription = {
protocol = "lambda"
endpoint_auto_confirms = false
confirmation_timeout_in_minutes = null
raw_message_delivery = null
filter_policy = null
delivery_policy = null
redrive_policy = null
}
}
#--------------------------------------------------------------
# Delivery: log
# Each log group in CloudWatchLogs is transferred to S3 by Kinesis Data Firehose.
# Specify the target log group in the log_group_names variable to transfer logs to S3.
#--------------------------------------------------------------
delivery_log = {
#--------------------------------------------------------------
# Provides a Kinesis Firehose Delivery Stream resource. Amazon Kinesis Firehose is a fully managed, elastic service to easily deliver real-time data streams to destinations such as Amazon S3 and Amazon Redshift.
#--------------------------------------------------------------
aws_kinesis_firehose_delivery_stream = {
buffer_size = 5
buffer_interval = 60
prefix = "Logs/"
compression_format = "GZIP"
cloudwatch_logging_options = [
{
enabled = false
}
]
}
# TODO: need to add log_group_name for application.
# check log group name for application.
# check CloudWatch Group name list command.
# ex1) aws logs describe-log-groups --log-group-name-prefix hogehoge | jq -r ".logGroups[].logGroupName"
# ex2) aws logs describe-log-groups --log-group-name-prefix /aws/lambda | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
# ex3) aws logs describe-log-groups | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
log_group_names = []
aws_iam_role_kinesis_firehose = {
description = null
name = "monitor-kinesis-firehose-role"
path = "/"
}
aws_iam_policy_kinesis_firehose = {
description = null
name = "monitor-kinesis-firehose-policy"
path = "/"
}
aws_iam_role_cloudwatch_logs = {
description = null
name = "monitor-cloudwatch-logs-kinesis-firehose-role"
path = "/"
}
aws_iam_policy_cloudwatch_logs = {
description = null
name = "monitor-cloudwatch-logs-kinesis-firehose-policy"
path = "/"
}
}
#--------------------------------------------------------------
# Delivery: log(us-east-1)
# Each log group in CloudWatchLogs is transferred to S3 by Kinesis Data Firehose.
# Specify the target log group in the log_group_names variable to transfer logs to S3.
#--------------------------------------------------------------
delivery_log_us_east_1 = {
#--------------------------------------------------------------
# Provides a Kinesis Firehose Delivery Stream resource. Amazon Kinesis Firehose is a fully managed, elastic service to easily deliver real-time data streams to destinations such as Amazon S3 and Amazon Redshift.
#--------------------------------------------------------------
aws_kinesis_firehose_delivery_stream = {
buffer_size = 5
buffer_interval = 60
prefix = "Logs/"
compression_format = "GZIP"
cloudwatch_logging_options = [
{
enabled = false
}
]
}
# TODO: need to add log_group_name for application.
# check log group name for application.
# check CloudWatch Group name list command.
# ex1) aws logs describe-log-groups --region us-east-1 --log-group-name-prefix hogehoge | jq -r ".logGroups[].logGroupName"
# ex2) aws logs describe-log-groups --region us-east-1 --log-group-name-prefix /aws/lambda | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
# ex3) aws logs describe-log-groups --region us-east-1 | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
log_group_names = []
aws_iam_role_kinesis_firehose = {
description = null
name = "monitor-kinesis-firehose-us-east-1-role"
path = "/"
}
aws_iam_policy_kinesis_firehose = {
description = null
name = "monitor-kinesis-firehose-us-east-1-policy"
path = "/"
}
aws_iam_role_cloudwatch_logs = {
description = null
name = "monitor-cloudwatch-logs-kinesis-firehose-us-east-1-role"
path = "/"
}
aws_iam_policy_cloudwatch_logs = {
description = null
name = "monitor-cloudwatch-logs-kinesis-firehose-us-east-1-policy"
path = "/"
}
}
#--------------------------------------------------------------
# Log:Application
# The filter function of CloudWatchLogs can be used to check specified logs
# with specified filter patterns. Those that hit the filter pattern will be
# notified by Slack via Lambda.
#
# Filter logs related to Application.
#--------------------------------------------------------------
metric_log_application = {
# TODO: need to set is_enabled for settings of application log.
is_enabled = false
# TODO: need to add log_group_name for application.
# check log group name for application.
# check CloudWatch Group name list command.
# ex1) aws logs describe-log-groups --log-group-name-prefix hogehoge | jq -r ".logGroups[].logGroupName"
# ex2) aws logs describe-log-groups --log-group-name-prefix /aws/lambda | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
log_group_names = []
aws_cloudwatch_log_metric_filter = {
name = "application-logs-error"
# TODO: need to change pattern for application log.
# ex1) ?error ?Error ?ERROR ?fatal ?Fatal ?FATAL ?exception ?Exception ?EXCEPTION
# ex2) ?"\"level\":\"error\"" ?"\"level\":\"fatal\"" ?"\"level\":\"panic\""
pattern = <<PATTERN
?"\"level\":\"error\"" ?"\"level\":\"fatal\"" ?"\"level\":\"panic\""
PATTERN
metric_transformation = [
{
name = "application-logs-error"
namespace = "Application"
value = "1"
}
]
}
aws_cloudwatch_metric_alarm = {
alarm_name = "application-logs-error"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
period = 300
statistic = "Sum"
threshold = 1
threshold_metric_id = null
actions_enabled = true
alarm_description = "Alert log notification."
datapoints_to_alarm = 1
dimensions = null
treat_missing_data = "notBreaching"
}
}
#--------------------------------------------------------------
# Log:MySQL slow query
# The filter function of CloudWatchLogs can be used to check specified logs
# with specified filter patterns. Those that hit the filter pattern will be
# notified by Slack via Lambda.
#
# Filter logs related to MySQL.
#--------------------------------------------------------------
metric_log_mysql_slowquery = {
# TODO: need to set is_enabled for settings of postgres log.
is_enabled = false
# TODO: need to add log_group_name for postgres.
# check log group name for postgres.
# check CloudWatch Group name list command.
# ex1) aws logs describe-log-groups --log-group-name-prefix hogehoge | jq -r ".logGroups[].logGroupName"
# ex2) aws logs describe-log-groups --log-group-name-prefix /aws/rds/ | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
log_group_names = []
aws_cloudwatch_log_metric_filter = {
name = "mysql-slowquery-logs-error"
# TODO: need to change pattern for postgres log.
pattern = <<PATTERN
-rdsproxy -rdsproxyadmin -rdsadmin
PATTERN
metric_transformation = [
{
name = "mysql-slowquery-logs-error"
namespace = "MySQL"
value = "1"
}
]
}
aws_cloudwatch_metric_alarm = {
alarm_name = "mysql-slowquery-logs-error"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
period = 300
statistic = "Sum"
threshold = 1
threshold_metric_id = null
actions_enabled = true
alarm_description = "Alert MySQL slow query log notification."
datapoints_to_alarm = 1
dimensions = null
treat_missing_data = "notBreaching"
}
}
#--------------------------------------------------------------
# Log:Postgres
# The filter function of CloudWatchLogs can be used to check specified logs
# with specified filter patterns. Those that hit the filter pattern will be
# notified by Slack via Lambda.
#
# Filter logs related to Postgres.
#--------------------------------------------------------------
metric_log_postgres = {
# TODO: need to set is_enabled for settings of postgres log.
is_enabled = false
# TODO: need to add log_group_name for postgres.
# check log group name for postgres.
# check CloudWatch Group name list command.
# ex1) aws logs describe-log-groups --log-group-name-prefix hogehoge | jq -r ".logGroups[].logGroupName"
# ex2) aws logs describe-log-groups --log-group-name-prefix /aws/rds/ | jq -r '.logGroups[] | .logGroupName = "\"" + .logGroupName + "\"," | .logGroupName'
log_group_names = []
aws_cloudwatch_log_metric_filter = {
name = "postgres-logs-error"
# TODO: need to change pattern for postgres log.
pattern = <<PATTERN
?ERROR
PATTERN
metric_transformation = [
{
name = "postgres-logs-error"
namespace = "Postgres"
value = "1"
}
]
}
aws_cloudwatch_metric_alarm = {
alarm_name = "postgres-logs-error"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
period = 300
statistic = "Sum"
threshold = 1
threshold_metric_id = null
actions_enabled = true
alarm_description = "Alert Postgres log notification."
datapoints_to_alarm = 1
dimensions = null
treat_missing_data = "notBreaching"
}
}
#--------------------------------------------------------------
# Metrics:ALB
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about ALB will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html
#--------------------------------------------------------------
metric_resource_alb = {
# TODO: need to set is_enabled for Metric of ALB.
is_enabled = false
# TODO: need to set period for ALB.
period = 1800
# TODO: need to set threshold for ALB.
threshold = {
# (Required) ActiveConnectionCount threshold (unit=Count)
enabled_active_connection_count = true
active_connection_count = 10000
# (Required) ClientTLSNegotiationErrorCount threshold (unit=Count)
enabled_client_tls_negotiation_error_count = true
client_tls_negotiation_error_count = 10
# (Required) ConsumedLCUs threshold (unit=Count)
enabled_consumed_lcus = true
consumed_lcus = 5
# (Required) HTTPCode_4XX_Count threshold (unit=Count)
enabled_httpcode_4xx_count = true
httpcode_4xx_count = 1
# (Required) HTTPCode_5XX_Count threshold (unit=Count)
enabled_httpcode_5xx_count = true
httpcode_5xx_count = 1
# (Required) HTTPCode_ELB_4XX_Count threshold (unit=Count)
enabled_httpcode_elb_4xx_count = true
httpcode_elb_4xx_count = 1
# (Required) HTTPCode_ELB_5XX_Count threshold (unit=Count)
enabled_httpcode_elb_5xx_count = true
httpcode_elb_5xx_count = 1
# (Required) TargetResponseTime threshold (unit=)
enabled_target_response_time = true
target_response_time = 10
# (Required) TargetTLSNegotiationErrorCount threshold (unit=Count)
enabled_target_tls_negotiation_error_count = true
target_tls_negotiation_error_count = 10
# (Required) UnHealthyHostCount threshold (unit=Count)
enabled_unhealthy_host_count = true
unhealthy_host_count = 1
}
# TODO: need to set dimensions for monitor of ALB.
# Specify the instance of the target ALB name to be monitored by Map.
# ex)
# dimensions = [
# {
# "LoadBalancer" = "example-alb"
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:API Gateway
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about API Gateway will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html
#--------------------------------------------------------------
metric_resource_api_gateway = {
# TODO: need to set is_enabled for Metric of API Gateway.
is_enabled = false
# TODO: need to set period for API Gateway.
period = 300
# TODO: need to set threshold for API Gateway.
threshold = {
# (Required) 4XXerror threshold (unit=%)
enabled_error4XX = true
error4XX = 1
# (Required) 5XXerror threshold (unit=%)
enabled_error5XX = true
error5XX = 1
# (Required) Error threshold (unit=Milliseconds)
enabled_latency = true
latency = 10000
}
# TODO: need to set dimensions for monitor of API Gateway.
# Specify the instance of the target API Gateway name to be monitored by Map.
# check API Gateway name list command.
# ex) aws apigateway get-rest-apis | jq -r '.items[] | .Dimensions = "{\n \"ApiName\" = \"" + .name + "\"\n}," | .Dimensions'
# ex)
# dimensions = [
# {
# "ApiName" = "example-api"
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:CloudFront
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about CloudFront will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/monitoring-using-cloudwatch.html
#--------------------------------------------------------------
metric_resource_cloudfront = {
# TODO: need to set is_enabled for Metric of CloudFront.
is_enabled = false
# TODO: need to set period for CloudFront.
period = 1800
# TODO: need to set threshold for CloudFront.
threshold = {
# (Required) Error401Rate threshold (unit=%)
enabled_error_401_rate = false
error_401_rate = 1
# (Required) Error403Rate threshold (unit=%)
enabled_error_403_rate = false
error_403_rate = 1
# (Required) Error404Rate threshold (unit=%)
enabled_error_404_rate = true
error_404_rate = 1
# (Required) Error502Rate threshold (unit=%)
enabled_error_502_rate = true
error_502_rate = 1
# (Required) Error503Rate threshold (unit=%)
enabled_error_503_rate = true
error_503_rate = 1
# (Required) Error504Rate threshold (unit=%)
enabled_error_504_rate = true
error_504_rate = 1
# (Required) CacheHitRate threshold (unit=%)
enabled_cache_hit_rate = true
cache_hit_rate = 70
# (Required) OriginLatency threshold (unit=Milliseconds)
enabled_origin_latency = true
origin_latency = 10000
}
# TODO: need to set dimensions for monitor of CloudFront.
# Specify the instance of the target CloudFront name to be monitored by Map.
# check CloudFront distribution name list command.
# ex) aws cloudfront list-distributions | jq -r '.DistributionList.Items[] | if .Aliases.Items[0] then .Dimensions = "{\n \"DistributionId\" = \"" + .Id + "\"\n \"Region\" = \"Global\"\n \"Domain\" = \"" + .Aliases.Items[0] + "\"\n }," else .Dimensions = "{\n \"DistributionId\" = \"" + .Id + "\"\n \"Region\" = \"Global\"\n \"Domain\" = \"" + .DomainName + "\"\n }," end | .Dimensions'
# ex)
# dimensions = [
# {
# "DistributionId" = "ABCDEFG12345"
# "Region" = "Global"
# "Domain" = "aaaaaaaaaaaa.cloudfront.net"
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:EC2
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about EC2 will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html
#--------------------------------------------------------------
metric_resource_ec2 = {
# TODO: need to set is_enabled for Metric of EC2.
is_enabled = false
# TODO: need to set period for EC2.
period = 300
# TODO: need to set threshold for EC2.
threshold = {
# (Required) CPUUtilization threshold (unit=Percent)
enabled_cpu_utilization = true
cpu_utilization = 80
# (Required) MetadataNoToken threshold (unit=Count)
enabled_metadata_no_token = true
metadata_no_token = 1
# (Required) CPUCreditUsage threshold (unit=Count)
enabled_cpu_credit_usage = true
cpu_credit_usage = 5
# (Required) StatusCheckFailed threshold (unit=Count)
enabled_status_check_failed = true
status_check_failed = 1
}
# TODO: need to set dimensions for monitor of EC2.
# Specify the instance of the target CloudFront name to be monitored by Map.
# check EC2 distribution name list command.
# ex) aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | .Dimensions = "{\n \"InstanceId\" = \"" + .InstanceId + "\" # " + .InstanceType + "\n}," | .Dimensions'
# ex)
# dimensions = [
# {
# "InstanceId" = "i-xxxxxxxxxxxxxxx" # t3.small
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:ElastiCache
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about ElastiCache will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheMetrics.html
#--------------------------------------------------------------
metric_resource_elasticache = {
# TODO: need to set is_enabled for Metric of ElastiCache.
is_enabled = false
# TODO: need to set period for ElastiCache.
period = 300
# TODO: need to set threshold for ElastiCache.
threshold = {
# (Required) AuthenticationFailures threshold (unit=Count)
enabled_authentication_failures = true
authentication_failures = 1
# (Required) CacheHitRate threshold (unit=Percent)
enabled_cache_hit_rate = true
cache_hit_rate = 10
# (Required) CommandAuthorizationFailures threshold (unit=Count)
enabled_command_authorization_failures = true
command_authorization_failures = 1
# (Required) CurrConnections threshold (unit=Count)
enabled_curr_connections = true
curr_connections = 50
# (Required) DatabaseMemoryUsagePercentage threshold (unit=Percent)
enabled_database_memory_usage_percentage = true
database_memory_usage_percentage = 80
# (Required) EngineCPUUtilization threshold (unit=Percent)
enabled_engine_cpu_utilization = true
engine_cpu_utilization = 90
# (Required) KeyAuthorizationFailures threshold (unit=Count)
enabled_key_authorization_failures = true
key_authorization_failures = 1
# (Required) NewConnections threshold (unit=Count)
enabled_new_connections = true
new_connections = 100
# (Required) SwapUsage threshold (unit=Bytes)
enabled_swap_usage = true
swap_usage = 52428800 # 50MB
}
# TODO: need to set dimensions for monitor of ElastiCache.
# Specify the instance of the target ElastiCache name to be monitored by Map.
# check ElastiCache CacheClusterId list command.
# ex) aws elasticache describe-cache-clusters | jq -r '.CacheClusters[] | .Dimensions = "{\n \"CacheClusterId\" = \"" + .CacheClusterId + "\" # " + .CacheNodeType + "\n}," | .Dimensions'
# ex)
# dimensions = [
# {
# "CacheClusterId" = "cluster-1"
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:Lambda
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about Lambda will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html
#--------------------------------------------------------------
metric_resource_lambda = {
# TODO: need to set is_enabled for monitor of Lambda.
is_enabled = false
# TODO: need to set period for Lambda.
period = 300
# TODO: need to set threshold for Lambda.
threshold = {
# (Required) ConcurrentExecutions threshold (unit=Count)
enabled_concurrent_executions = true
concurrent_executions = 500
# (Required) Duration threshold (unit=Milliseconds)
enabled_duration = true
duration = 10000
# (Required) Errors threshold (unit=Count)
enabled_errors = true
errors = 1
# (Required) Throttles threshold (unit=Count)
enabled_throttles = true
throttles = 10
}
# TODO: need to set dimensions for monitor of Lambda.
# Specify the instance of the target Lambda name to be monitored by Map.
# check Lambda function name list command.
# ex) aws lambda list-functions | jq -r '.Functions[] | .Dimensions = "{\n \"FunctionName\" = \"" + .FunctionName + "\"\n}," | .Dimensions'
# ex)
# dimensions = [
# {
# "FunctionName" = "function-1"
# },
# {
# "FunctionName" = "function-2"
# },
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:RDS
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about RDS will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/monitoring-cloudwatch.html
#--------------------------------------------------------------
metric_resource_rds = {
# TODO: need to set is_enabled for monitor of RDS.
is_enabled = false
# TODO: need to set is_aurora for monitor of RDS(Aurora).
# If the target DB to be monitored is Aurora, set to true.
is_aurora = true
# TODO: need to set is_aurora for monitor of RDS(MySQL).
# If the target DB to be monitored is MySQL, set to true.
is_mysql = false
# TODO: need to set is_aurora for monitor of RDS(Postgres).
# If the target DB to be monitored is Postgres, set to true.
is_postgres = false
# TODO: need to set period for RDS.
period = 300
# TODO: need to set threshold for RDS.
threshold = {
# (Required) CommitRatency threshold (unit=Seconds)
enabled_commit_latency = true
commit_latency = 10
# (Required) CPUCreditBalance threshold (unit=Count)
enabled_cpu_creadit_balance = true
cpu_creadit_balance = 100
# (Required) CPUUtilization threshold (unit=%)
enabled_cpu_utilization = true
cpu_utilization = 80
# (Required) DatabaseConnections threshold (unit=Count)
enabled_database_connections = true
database_connections = 100
# (Required) Deadlocks threshold (unit=Count)
enabled_deadlocks = true
deadlocks = 1
# (Required) DeleteLatency threshold (unit=Count)
enabled_delete_latency = true
delete_latency = 10
# (Required) DiskQueueDepth threshold (unit=Count)
enabled_disk_queue_depth = true
disk_queue_depth = 64
# (Required) FreeableMemory threshold (unit=Megabytes)
enabled_freeable_memory = true
freeable_memory = 512
# (Required) ReadLatency threshold (unit=Seconds)
enabled_read_latency = true
read_latency = 10
# (Required) WriteLatency threshold (unit=Seconds)
enabled_write_latency = true
write_latency = 10
}
# TODO: need to set dimensions for monitor of RDS.
# Specify the instance of the target DB to be monitored by Map.
# check DB Cluster Identifier list command.
# ex) aws rds describe-db-clusters | jq -r '.DBClusters[] | .Dimensions = "{\n \"DBClusterIdentifier\" = \"" + .DBClusterIdentifier + "\"\n}," | .Dimensions'
# ex) RDS
# dimensions = [
# {
# "DBInstanceIdentifier" = "exampledb"
# }
# ]
# ex) RDS(Aurora)
# dimensions = [
# {
# "DBClusterIdentifier" = "exampledb"
# }
# ]
dimensions = []
}
#--------------------------------------------------------------
# Metrics:SES
# Metrics are data about the performance of your systems. By default,
# many services provide free metrics for resources (such as Amazon EC2 instances,
# Amazon EBS volumes, and Amazon RDS DB instances).
# You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances,
# or publish your own application metrics. Amazon CloudWatch can load all the metrics in your account
# (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.
#
# Metrics about SES will be checked and you will be notified via Slack if the specified threshold is exceeded.
# https://docs.aws.amazon.com/ses/latest/dg/event-publishing-retrieving-cloudwatch.html
#--------------------------------------------------------------
metric_resource_ses = {
# TODO: need to set is_enabled for monitor of SES.
is_enabled = false
# TODO: need to set period for SES.
period = 300
# TODO: need to set threshold for SES.
threshold = {
# Reputation.BounceRate threshold (unit=Percent)
enabled_reputation_bouncerate = true
reputation_bouncerate = 5
# Reputation.ComplaintRate threshold (unit=Percent)
enabled_reputation_complaintrate = true
reputation_complaintrate = 0.1
}
dimensions = []
}
#--------------------------------------------------------------
# CloudWatch Events:EC2
# The following events are monitored.
# - EC2 Instance Rebalance Recommendation
# - EC2 Spot Instance Interruption Warning
#--------------------------------------------------------------
cloudwatch_event_ec2 = {
# TODO: need to set is_enabled for settings of EC2.
is_enabled = false
aws_cloudwatch_event_rule = {
name = "ec2-cloudwatch-event-rule"
description = "This cloudwatch event used for EC2."
is_enabled = true
}
aws_cloudwatch_log_group_lambda = {
# TODO: need to change retention_in_days for each services.
retention_in_days = 14
kms_key_id = null
}
aws_lambda_function = {
environment = {
LANGUAGE = "en"
# TODO: need to change SLACK_OAUTH_ACCESS_TOKEN.(bot token xoxb-xxxxxx....)