File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
beginners/aws/API_Gateway & Cloudwatch Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ resource "aws_sns_topic" "sns" {
2
+ name = " user-updates-topic"
3
+ }
4
+
5
+ locals {
6
+ rest_api_id = aws_api_gateway_rest_api. panda . id
7
+ }
8
+
9
+ output "rest_api_id" {
10
+ value = local. rest_api_id
11
+ }
12
+
13
+ resource "aws_route53_health_check" "http" {
14
+ fqdn = format (" %s.%s" ,aws_api_gateway_rest_api. panda . id ," execute-api.enter_region.amazonaws.com" )
15
+ insufficient_data_health_status = " Healthy"
16
+ port = 443
17
+ type = " HTTPS"
18
+ resource_path = " /"
19
+ failure_threshold = " 3"
20
+ request_interval = " 30"
21
+
22
+ tags = {
23
+ Name = " api-health-check"
24
+ }
25
+ }
26
+ resource "aws_cloudwatch_metric_alarm" "http1" {
27
+ depends_on = [aws_route53_health_check . http ]
28
+ alarm_name = " foobar"
29
+ comparison_operator = " LessThanThreshold"
30
+ evaluation_periods = " 1"
31
+ metric_name = " HealthCheckStatus"
32
+ namespace = " AWS/Route53"
33
+ period = " 60"
34
+ statistic = " Minimum"
35
+ alarm_description = " This metric monitors ec2 cpu utilization"
36
+ actions_enabled = " true"
37
+ alarm_actions = [aws_sns_topic . sns . arn ]
38
+ ok_actions = [aws_sns_topic . sns . arn ]
39
+
40
+ dimensions = {
41
+ HealthCheckName = " api-health-check"
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments