Interface ICronOptions
Options to configure a cron expression.
Namespace: Amazon.CDK.AWS.ApplicationAutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ICronOptions
Syntax (vb)
Public Interface ICronOptions
Remarks
All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.
See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions
ExampleMetadata: infused
Examples
Cluster cluster;
var loadBalancedFargateService = new ApplicationLoadBalancedFargateService(this, "Service", new ApplicationLoadBalancedFargateServiceProps {
Cluster = cluster,
MemoryLimitMiB = 1024,
DesiredCount = 1,
Cpu = 512,
TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
}
});
var scalableTarget = loadBalancedFargateService.Service.AutoScaleTaskCount(new EnableScalingProps {
MinCapacity = 5,
MaxCapacity = 20
});
scalableTarget.ScaleOnSchedule("DaytimeScaleDown", new ScalingSchedule {
Schedule = Schedule.Cron(new CronOptions { Hour = "8", Minute = "0" }),
MinCapacity = 1
});
scalableTarget.ScaleOnSchedule("EveningRushScaleUp", new ScalingSchedule {
Schedule = Schedule.Cron(new CronOptions { Hour = "20", Minute = "0" }),
MinCapacity = 10
});
Synopsis
Properties
Day | The day of the month to run this rule at. |
Hour | The hour to run this rule at. |
Minute | The minute to run this rule at. |
Month | The month to run this rule at. |
WeekDay | The day of the week to run this rule at. |
Year | The year to run this rule at. |
Properties
Day
The day of the month to run this rule at.
virtual string Day { get; }
Property Value
System.String
Remarks
Default: - Every day of the month
Hour
The hour to run this rule at.
virtual string Hour { get; }
Property Value
System.String
Remarks
Default: - Every hour
Minute
The minute to run this rule at.
virtual string Minute { get; }
Property Value
System.String
Remarks
Default: - Every minute
Month
The month to run this rule at.
virtual string Month { get; }
Property Value
System.String
Remarks
Default: - Every month
WeekDay
The day of the week to run this rule at.
virtual string WeekDay { get; }
Property Value
System.String
Remarks
Default: - Any day of the week
Year
The year to run this rule at.
virtual string Year { get; }
Property Value
System.String
Remarks
Default: - Every year