Resource: awsAppautoscalingScheduledAction
Provides an Application AutoScaling ScheduledAction resource.
Example Usage
DynamoDB Table Autoscaling
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsAppautoscalingTargetDynamodb =
new aws.appautoscalingTarget.AppautoscalingTarget(this, "dynamodb", {
maxCapacity: 100,
minCapacity: 5,
resourceId: "table/tableName",
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});
const awsAppautoscalingScheduledActionDynamodb =
new aws.appautoscalingScheduledAction.AppautoscalingScheduledAction(
this,
"dynamodb_1",
{
name: "dynamodb",
resourceId: awsAppautoscalingTargetDynamodb.resourceId,
scalableDimension: awsAppautoscalingTargetDynamodb.scalableDimension,
scalableTargetAction: {
maxCapacity: 200,
minCapacity: 1,
},
schedule: "at(2006-01-02T15:04:05)",
serviceNamespace: awsAppautoscalingTargetDynamodb.serviceNamespace,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAppautoscalingScheduledActionDynamodb.overrideLogicalId("dynamodb");
ECS Service Autoscaling
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsAppautoscalingTargetEcs =
new aws.appautoscalingTarget.AppautoscalingTarget(this, "ecs", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const awsAppautoscalingScheduledActionEcs =
new aws.appautoscalingScheduledAction.AppautoscalingScheduledAction(
this,
"ecs_1",
{
name: "ecs",
resourceId: awsAppautoscalingTargetEcs.resourceId,
scalableDimension: awsAppautoscalingTargetEcs.scalableDimension,
scalableTargetAction: {
maxCapacity: 10,
minCapacity: 1,
},
schedule: "at(2006-01-02T15:04:05)",
serviceNamespace: awsAppautoscalingTargetEcs.serviceNamespace,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsAppautoscalingScheduledActionEcs.overrideLogicalId("ecs");
Argument Reference
The following arguments are supported:
name
- (Required) Name of the scheduled action.serviceNamespace
- (Required) Namespace of the AWS service. Documentation can be found in theserviceNamespace
parameter at: AWS Application Auto Scaling API Reference Example: ecsresourceId
- (Required) Identifier of the resource associated with the scheduled action. Documentation can be found in theresourceId
parameter at: AWS Application Auto Scaling API ReferencescalableDimension
- (Required) Scalable dimension. Documentation can be found in thescalableDimension
parameter at: AWS Application Auto Scaling API Reference Example: ecs:service:DesiredCountscalableTargetAction
- (Required) New minimum and maximum capacity. You can set both values or just one. See belowschedule
- (Required) 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). Times for at expressions and cron expressions are evaluated using the time zone configured intimezone
. Documentation can be found in thetimezone
parameter at: AWS Application Auto Scaling API ReferencestartTime
- (Optional) Date and time for the scheduled action to start in RFC 3339 format. The timezone is not affected by the setting oftimezone
.endTime
- (Optional) Date and time for the scheduled action to end in RFC 3339 format. The timezone is not affected by the setting oftimezone
.timezone
- (Optional) Time zone used when setting a scheduled action by using an at or cron expression. Does not affect timezone forstartTime
andendTime
. Valid values are the canonical names of the IANA time zones supported by Joda-Time, such asetc/gmt+9
orpacific/tahiti
. Default isutc
.
Scalable Target Action Arguments
maxCapacity
- (Optional) Maximum capacity. At least one ofmaxCapacity
orminCapacity
must be set.minCapacity
- (Optional) Minimum capacity. At least one ofminCapacity
ormaxCapacity
must be set.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
arn
- ARN of the scheduled action.