-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
110 lines (103 loc) · 3.87 KB
/
main.tf
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
provider "aws" {
region = "us-east-2"
}
provider "random" {
alias = "rd"
}
provider "aws" {
alias = "master"
region = "us-east-2"
}
module "ecs-ec2-deploy" {
source = "./modules/ecs-ec2-deploy"
}
module "svc-scaling" {
source = "./modules/svc-scaling"
cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
service_name = module.ecs-ec2-deploy.aws_ecs_service_name
alarm_name = "ba_cpu_stressapp"
scale_policy_name_prefix = "ba_cpu_stressapp"
ecs-autoscale-role_arn = module.ecs-ec2-deploy.aws_iam_role_ecs_asg_role_arn
statistic = "Average"
scale_up_adjustment = "100"
scale_down_adjustment = "-50"
threshold_up = "90"
threshold_down = "30"
dims = [ {name= "ClusterName",value=module.ecs-ec2-deploy.aws_ecs_cluster_name }
,{name= "ServiceName",value=module.ecs-ec2-deploy.aws_ecs_service_name }
]
}
module "svc-tracking-scaling" {
source = "./modules/svc-tracking-scaling"
cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
service_name = module.ecs-ec2-deploy.aws_ecs_service_name
alarm_name = "ba_cpu_tracking_stressapp"
scale_policy_name_prefix = "ba_cpu_tracking_stressapp"
min_capacity = "1"
max_capacity = "70"
}
module "svc-scaling-lb-rsp-time" {
source = "./modules/svc-scaling"
cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
service_name = module.ecs-ec2-deploy.aws_ecs_service_name
alarm_name = "ba_lb-rsp-time_stressapp"
scale_policy_name_prefix = "ba_lb-rsp-time_stressapp"
statistic = "Average"
namespace = "AWS/ApplicationELB"
metric_name = "TargetResponseTime"
scale_up_adjustment = "70"
scale_down_adjustment = "-25"
evaluation_periods = 1
datapoints_to_alarm_up = 1
datapoints_to_alarm_down = 1
threshold_up = "0.170"
threshold_down = "0"
ecs-autoscale-role_arn = module.ecs-ec2-deploy.aws_iam_role_ecs_asg_role_arn
dims = [ {name= "TargetGroup" ,value=module.ecs-ec2-deploy.aws_alb_target_group_app_arn_suffix }
,{name= "LoadBalancer",value=module.ecs-ec2-deploy.aws_alb_arn_suffix }
]
}
module "svc-tracking-scaling-lb-rsp-time" {
source = "./modules/svc-tracking-scaling-custom"
cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
service_name = module.ecs-ec2-deploy.aws_ecs_service_name
alarm_name = "ba_lb-rsp-time_tracking_stressapp"
scale_policy_name_prefix = "ba_lb-rsp-time_tracking_stressapp"
namespace = "AWS/ApplicationELB"
metric_name = "TargetResponseTime"
min_capacity = "1"
max_capacity = "70"
target_value = "0.130"
scale_in_cooldown = 10
scale_out_cooldown = 5
disable_scale_in= true
dims = [ {name= "TargetGroup" ,value=module.ecs-ec2-deploy.aws_alb_target_group_app_arn_suffix }
,{name= "LoadBalancer",value=module.ecs-ec2-deploy.aws_alb_arn_suffix }
]
}
# module "svc-scaling-mem" {
# source = "./modules/svc-scaling"
# cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
# service_name = module.ecs-ec2-deploy.aws_ecs_service_name
# alarm_name = "ba_mem_stressapp"
# scale_policy_name_prefix = "ba_stressapp"
# min_capacity = "1"
# max_capacity = "70"
# statistic = "Maximum"
# metric_name = "MemoryUtilization"
# scale_up_adjustment = "100"
# scale_down_adjustment = "50"
# threshold_up = "90"
# threshold_down = "30"
# ecs-autoscale-role_arn = module.ecs-ec2-deploy.aws_iam_role_ecs_asg_role_arn
# }
# module "svc-tracking-scaling-mem" {
# source = "./modules/svc-tracking-scaling-mem"
# cluster_name = module.ecs-ec2-deploy.aws_ecs_cluster_name
# service_name = module.ecs-ec2-deploy.aws_ecs_service_name
# alarm_name = "ba_mem_stressapp"
# scale_policy_name_prefix = "ba_stressapp"
# min_capacity = "1"
# max_capacity = "70"
# statistic = "Maximum"
# }