Skip to content

cn-terraform/terraform-aws-ecs-service-autoscaling

Repository files navigation

AWS ECS Service Autoscaling Module

This Terraform module deploys autoscaling alarms for an AWS ECS Fargate service.

Usage

Check valid versions on:

Other modules that you may need to use this module

The Networking module:

The ECS cluster module:

The ECS Task Definition:

The ECS Service module:

Install pre commit hooks.

Pleas run this command right after cloning the repository.

    pre-commit install

For that you may need to install the folowwing tools:

In order to run all checks at any point run the following command:

    pre-commit run --all-files

Requirements

Name Version
terraform >= 0.13
aws >= 4

Providers

Name Version
aws 5.44.0

Modules

No modules.

Resources

Name Type
aws_appautoscaling_policy.scale_down_policy resource
aws_appautoscaling_policy.scale_up_policy resource
aws_appautoscaling_target.scale_target resource
aws_cloudwatch_metric_alarm.cpu_high resource
aws_cloudwatch_metric_alarm.cpu_low resource

Inputs

Name Description Type Default Required
cooldown Cooldown period for scaling actions number 60 no
ecs_cluster_name Name of the ECS cluster any n/a yes
ecs_service_name Name of the ECS service any n/a yes
max_cpu_evaluation_period The number of periods over which data is compared to the specified threshold for max cpu metric alarm string "3" no
max_cpu_period The period in seconds over which the specified statistic is applied for max cpu metric alarm string "60" no
max_cpu_threshold Threshold for max CPU usage string "85" no
min_cpu_evaluation_period The number of periods over which data is compared to the specified threshold for min cpu metric alarm string "3" no
min_cpu_period The period in seconds over which the specified statistic is applied for min cpu metric alarm string "60" no
min_cpu_threshold Threshold for min CPU usage string "10" no
name_prefix Name prefix for resources on AWS any n/a yes
scale_target_max_capacity The max capacity of the scalable target number 5 no
scale_target_min_capacity The min capacity of the scalable target number 1 no
sns_topic_arn The ARN of an SNS topic to send notifications on alarm actions. string "" no
tags Resource tags map(string) {} no

Outputs

No outputs.