aws_appautoscaling_scheduled_action
Provides an Application AutoScaling ScheduledAction resource.
Example Usage
DynamoDB Table Autoscaling
resource "aws_appautoscaling_target" "dynamodb" { max_capacity = 100 min_capacity = 5 resource_id = "table/tableName" role_arn = "${data.aws_iam_role.DynamoDBAutoscaleRole.arn}" scalable_dimension = "dynamodb:table:ReadCapacityUnits" service_namespace = "dynamodb" } resource "aws_appautoscaling_scheduled_action" "dynamodb" { name = "dynamodb" service_namespace = "${aws_appautoscaling_target.dynamodb.service_namespace}" resource_id = "${aws_appautoscaling_target.dynamodb.resource_id}" scalable_dimension = "${aws_appautoscaling_target.dynamodb.scalable_dimension}" schedule = "at(2006-01-02T15:04:05)" scalable_target_action { min_capacity = 1 max_capacity = 200 } }
ECS Service Autoscaling
resource "aws_appautoscaling_target" "ecs" { max_capacity = 4 min_capacity = 1 resource_id = "service/clusterName/serviceName" role_arn = "${var.ecs_iam_role}" scalable_dimension = "ecs:service:DesiredCount" service_namespace = "ecs" } resource "aws_appautoscaling_scheduled_action" "ecs" { name = "ecs" service_namespace = "${aws_appautoscaling_target.ecs.service_namespace}" resource_id = "${aws_appautoscaling_target.ecs.resource_id}" scalable_dimension = "${aws_appautoscaling_target.ecs.scalable_dimension}" schedule = "at(2006-01-02T15:04:05)" scalable_target_action { min_capacity = 1 max_capacity = 10 } }
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the scheduled action. -
service_namespace
- (Required) The namespace of the AWS service. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs -
resource_id
- (Required) The identifier of the resource associated with the scheduled action. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference -
scalable_dimension
- (Optional) The scalable dimension. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference Example: ecs:service:DesiredCount -
scalable_target_action
- (Optional) The new minimum and maximum capacity. You can set both values or just one. See below -
schedule
- (Optional) The schedule for this action. The following formats are supported: At expressions - at(yyyy-mm-ddThh:mm:ss), Rate expressions - rate(valueunit), Cron expressions - cron(fields). In UTC. Documentation can be found in the parameter at: AWS Application Auto Scaling API Reference -
start_time
- (Optional) The date and time for the scheduled action to start. Specify the following format: 2006-01-02T15:04:05Z -
end_time
- (Optional) The date and time for the scheduled action to end. Specify the following format: 2006-01-02T15:04:05Z
Scalable Target Action Arguments
-
max_capacity
- (Optional) The maximum capacity. -
min_capacity
- (Optional) The minimum capacity.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
-
arn
- The Amazon Resource Name (ARN) of the scheduled action.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/appautoscaling_scheduled_action.html