Skip to content

Instantly share code, notes, and snippets.

@sschrijver
Created September 22, 2020 05:53
Show Gist options
  • Save sschrijver/6c7b4dfe8b6833d9967551a1f0279a0d to your computer and use it in GitHub Desktop.
Save sschrijver/6c7b4dfe8b6833d9967551a1f0279a0d to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_metric_alarm" "sqs_scale_out" {
alarm_name = "SQS-ScaleOut-${var.service_name}"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
period = "60"
threshold = "1"
statistic = "Sum"
alarm_description = "SQS-ScaleOut-${var.service_name}"
insufficient_data_actions = []
alarm_actions = [
aws_appautoscaling_policy.scale_up_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