Skip to content

Commit 3cfd106

Browse files
Create route53_haelth_check.tf
1 parent 42f610c commit 3cfd106

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
}

0 commit comments

Comments
 (0)