Skip to content

Instantly share code, notes, and snippets.

@sschrijver
Created September 22, 2020 05:54
Show Gist options
  • Save sschrijver/93fb25ad6a0ec6acedbc6127076c6674 to your computer and use it in GitHub Desktop.
Save sschrijver/93fb25ad6a0ec6acedbc6127076c6674 to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_metric_alarm" "sqs_scale_in" {
alarm_name = "SQS-ScaleIn-${var.service_name}"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
period = "60"
threshold = "1"
statistic = "Sum"
alarm_description = "SQS-ScaleIn-${var.service_name}"
alarm_actions = [
aws_appautoscaling_policy.scale_down_fargate.arn]
dimensions = {
QueueName = var.queue_name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment