-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.yaml
201 lines (178 loc) · 8.13 KB
/
README.yaml
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
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AWS EC2 Autoscaling
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-ec2-autoscaling
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-ec2-autoscaling.svg"
url: "https://github.com/clouddrove/terraform-aws-ec2-autoscaling/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-ec2-autoscaling/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-ec2-autoscaling/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.6.6"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.31.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module will be created EC2 modulewith Autoscaling group.
usage: |-
Here is examples of how you can use this module in your inventory structure:
### On_Demand
```hcl
module "ec2-autoscale" {
version = "1.3.0"
enabled = true
name = "ec2"
environment = "test"
label_order = ["environment", "name"]
image_id = "ami-08bac620dc84221eb"
iam_instance_profile_name = module.iam-role.name
user_data_base64 = ""
instance_type = "t2.nano"
# on_dimand
on_demand_enabled = true
min_size = 1
desired_capacity = 1
max_size = 2
# schedule_instance
schedule_enabled = true
# up
scheduler_up = "0 8 * * MON-FRI"
min_size_scaleup = 2
scale_up_desired = 2
max_size_scaleup = 3
# down
scheduler_down = "0 22 * * MON-FRI"
min_size_scaledown = 1
scale_down_desired = 1
max_size_scaledown = 2
#volumes
volume_type = "standard"
ebs_encryption = false
kms_key_arn = ""
volume_size = 20
#Network
associate_public_ip_address = true
key_name = module.keypair.name
subnet_ids = tolist(module.public_subnets.public_subnet_id)
load_balancers = []
security_group_ids = [module.ssh.security_group_ids, module.http-https.security_group_ids]
min_elb_capacity = 0
target_group_arns = []
health_check_type = "EC2"
instance_initiated_shutdown_behavior = "terminate"
enable_monitoring = true
default_cooldown = 150
force_delete = false
termination_policies = ["Default"]
suspended_processes = []
enabled_metrics = ["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
metrics_granularity = "1Minute"
wait_for_capacity_timeout = "15m"
protect_from_scale_in = false
service_linked_role_arn = ""
scale_up_cooldown_seconds = 150
scale_up_scaling_adjustment = 1
scale_up_adjustment_type = "ChangeInCapacity"
scale_up_policy_type = "SimpleScaling"
scale_down_cooldown_seconds = 300
scale_down_scaling_adjustment = -1
scale_down_adjustment_type = "ChangeInCapacity"
scale_down_policy_type = "SimpleScaling"
cpu_utilization_high_evaluation_periods = 2
cpu_utilization_high_period_seconds = 300
cpu_utilization_high_threshold_percent = 10
cpu_utilization_high_statistic = "Average"
cpu_utilization_low_evaluation_periods = 2
cpu_utilization_low_period_seconds = 180
cpu_utilization_low_statistic = "Average"
cpu_utilization_low_threshold_percent = 1
}
```
### spot
```hcl
module "ec2-autoscale" {
enabled = true
name = "ec2"
environment = "test"
label_order = ["environment", "name"]
image_id = "ami-0ceab0713d94f9276"
iam_instance_profile_name = module.iam-role.name
security_group_ids = [module.ssh.security_group_ids, module.http-https.security_group_ids]
user_data_base64 = ""
subnet_ids = tolist(module.public_subnets.public_subnet_id)
spot_max_size = 3
spot_min_size = 1
spot_desired_capacity = 1
spot_enabled = true
on_demand_enabled = false
scheduler_down = "0 19 * * MON-FRI"
scheduler_up = "0 6 * * MON-FRI"
spot_min_size_scaledown = 1
spot_max_size_scaledown = 1
spot_schedule_enabled = false
spot_scale_down_desired = 1
spot_scale_up_desired = 2
max_price = "0.20"
volume_size = 20
ebs_encryption = false
kms_key_arn = ""
volume_type = "standard"
spot_instance_type = "m5.large"
associate_public_ip_address = true
instance_initiated_shutdown_behavior = "terminate"
key_name = module.keypair.name
enable_monitoring = true
load_balancers = []
health_check_type = "EC2"
target_group_arns = []
default_cooldown = 150
force_delete = false
termination_policies = ["Default"]
suspended_processes = []
enabled_metrics = ["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
metrics_granularity = "1Minute"
wait_for_capacity_timeout = "5m"
protect_from_scale_in = false
service_linked_role_arn = ""
scale_up_cooldown_seconds = 150
scale_up_scaling_adjustment = 1
scale_up_adjustment_type = "ChangeInCapacity"
scale_up_policy_type = "SimpleScaling"
scale_down_cooldown_seconds = 300
scale_down_scaling_adjustment = -1
scale_down_adjustment_type = "ChangeInCapacity"
scale_down_policy_type = "SimpleScaling"
cpu_utilization_high_evaluation_periods = 2
cpu_utilization_high_period_seconds = 300
cpu_utilization_high_threshold_percent = 10
cpu_utilization_high_statistic = "Average"
cpu_utilization_low_evaluation_periods = 2
cpu_utilization_low_period_seconds = 180
cpu_utilization_low_statistic = "Average"
cpu_utilization_low_threshold_percent = 1
}
```