Skip to content

Commit

Permalink
Switch default to arithmetic and better support Down when SQS is 0 wi…
Browse files Browse the repository at this point in the history
…th LessThanOrEqualToThreshold
  • Loading branch information
wesleung-appzen committed Aug 22, 2019
1 parent 63b32b6 commit 7a76820
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ resource "aws_appautoscaling_policy" "scale_down" {
resource "aws_cloudwatch_metric_alarm" "service_queue_high" {
alarm_name = "${module.label.id}-queue-count-high"
alarm_description = "This alarm monitors ${var.queue_name} Queue count utilization for scaling up"
comparison_operator = "GreaterThanOrEqualToThreshold"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "1"
threshold = "${var.high_threshold}"
alarm_actions = ["${aws_appautoscaling_policy.scale_up.arn}"]
Expand Down Expand Up @@ -182,16 +182,11 @@ resource "aws_cloudwatch_metric_alarm" "service_queue_high" {
resource "aws_cloudwatch_metric_alarm" "service_queue_low" {
alarm_name = "${module.label.id}-queue-count-low"
alarm_description = "This alarm monitors ${var.queue_name} Queue count utilization for scaling down"
comparison_operator = "LessThanThreshold"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "1"
threshold = "${var.low_threshold}"
alarm_actions = ["${aws_appautoscaling_policy.scale_down.arn}"]

# namespace = "AWS/SQS"
# period = "60"
# statistic = "Average"
# metric_name = "ApproximateNumberOfMessagesVisible"

metric_query {
id = "e1"
expression = "visible+notvisible"
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "adjustment_type_down" {
description = "Autoscaling policy down adjustment type (ChangeInCapacity, PercentChangeInCapacity)"
default = "ChangeInCapacity"
default = "ExactCapacity"
}

variable "adjustment_type_up" {
Expand Down

0 comments on commit 7a76820

Please sign in to comment.