aws-cdk-lib.aws_applicationautoscaling.ScalingSchedule

interface ScalingSchedule

LanguageType name
.NETAmazon.CDK.AWS.ApplicationAutoScaling.ScalingSchedule
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapplicationautoscaling#ScalingSchedule
Javasoftware.amazon.awscdk.services.applicationautoscaling.ScalingSchedule
Pythonaws_cdk.aws_applicationautoscaling.ScalingSchedule
TypeScript (source)aws-cdk-lib » aws_applicationautoscaling » ScalingSchedule

A scheduled scaling action.

Example

declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', {
  cluster,
  memoryLimitMiB: 1024,
  desiredCount: 1,
  cpu: 512,
  taskImageOptions: {
    image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
  },
});

const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({
  minCapacity: 5,
  maxCapacity: 20,
});

scalableTarget.scaleOnSchedule('DaytimeScaleDown', {
  schedule: appscaling.Schedule.cron({ hour: '8', minute: '0'}),
  minCapacity: 1,
});

scalableTarget.scaleOnSchedule('EveningRushScaleUp', {
  schedule: appscaling.Schedule.cron({ hour: '20', minute: '0'}),
  minCapacity: 10,
});

Properties

NameTypeDescription
scheduleScheduleWhen to perform this action.
endTime?dateWhen this scheduled action expires.
maxCapacity?numberThe new maximum capacity.
minCapacity?numberThe new minimum capacity.
startTime?dateWhen this scheduled action becomes active.

schedule

Type: Schedule

When to perform this action.


endTime?

Type: date (optional, default: The rule never expires.)

When this scheduled action expires.


maxCapacity?

Type: number (optional, default: No new maximum capacity)

The new maximum capacity.

During the scheduled time, the current capacity is above the maximum capacity, Application Auto Scaling scales in to the maximum capacity.

At least one of maxCapacity and minCapacity must be supplied.


minCapacity?

Type: number (optional, default: No new minimum capacity)

The new minimum capacity.

During the scheduled time, if the current capacity is below the minimum capacity, Application Auto Scaling scales out to the minimum capacity.

At least one of maxCapacity and minCapacity must be supplied.


startTime?

Type: date (optional, default: The rule is activate immediately)

When this scheduled action becomes active.