Class CfnScheduledAction
- Namespace
- Amazon.CDK.AWS.AutoScaling
- Assembly
- Amazon.CDK.AWS.AutoScaling.dll
A CloudFormation AWS::AutoScaling::ScheduledAction
.
public class CfnScheduledAction : CfnResource, IInspectable
- Inheritance
-
CfnScheduledAction
- Implements
-
IInspectable
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling;
var cfnScheduledAction = new CfnScheduledAction(this, "MyCfnScheduledAction", new CfnScheduledActionProps {
AutoScalingGroupName = "autoScalingGroupName",
// the properties below are optional
DesiredCapacity = 123,
EndTime = "endTime",
MaxSize = 123,
MinSize = 123,
Recurrence = "recurrence",
StartTime = "startTime",
TimeZone = "timeZone"
});
Remarks
The AWS::AutoScaling::ScheduledAction
resource specifies an Amazon EC2 Auto Scaling scheduled action so that the Auto Scaling group can change the number of instances available for your application in response to predictable load changes.
When you update a stack with an Auto Scaling group and scheduled action, CloudFormation always sets the min size, max size, and desired capacity properties of your group to the values that are defined in the AWS::AutoScaling::AutoScalingGroup
section of your template. However, you might not want CloudFormation to do that when you have a scheduled action in effect. You can use an UpdatePolicy attribute to prevent CloudFormation from changing the min size, max size, or desired capacity property values during a stack update unless you modified the individual values in your template. If you have rolling updates enabled, before you can update the Auto Scaling group, you must suspend scheduled actions by specifying an UpdatePolicy attribute for the Auto Scaling group. You can find a sample update policy for rolling updates in Auto scaling template snippets .
For more information, see Scheduled scaling and Suspending and resuming scaling processes in the Amazon EC2 Auto Scaling User Guide .
CloudformationResource: AWS::AutoScaling::ScheduledAction
ExampleMetadata: fixture=_generated
Constructors
CfnScheduledAction(Construct, string, ICfnScheduledActionProps)
Create a new AWS::AutoScaling::ScheduledAction
.
public CfnScheduledAction(Construct scope, string id, ICfnScheduledActionProps props)
Parameters
scope
Construct- scope in which this resource is defined.
id
string- scoped id of the resource.
props
ICfnScheduledActionProps- resource properties.
Properties
AttrScheduledActionName
Returns the name of a scheduled action.
public virtual string AttrScheduledActionName { get; }
Property Value
Remarks
CloudformationAttribute: ScheduledActionName
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
Remarks
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
DesiredCapacity
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
public virtual double? DesiredCapacity { get; set; }
Property Value
Remarks
It can scale beyond this capacity if you add more scaling conditions.
You must specify at least one of the following properties: <code>MaxSize</code> , <code>MinSize</code> , or <code>DesiredCapacity</code> .
EndTime
The date and time for the recurring schedule to end, in UTC.
public virtual string? EndTime { get; set; }
Property Value
Remarks
For example, "2021-06-01T00:00:00Z"
.
MaxSize
The maximum size of the Auto Scaling group.
public virtual double? MaxSize { get; set; }
Property Value
Remarks
MinSize
The minimum size of the Auto Scaling group.
public virtual double? MinSize { get; set; }
Property Value
Remarks
Recurrence
The recurring schedule for this action.
public virtual string? Recurrence { get; set; }
Property Value
Remarks
This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, "30 0 1 1,6,12 *"
). For more information about this format, see Crontab .
When StartTime
and EndTime
are specified with Recurrence
, they form the boundaries of when the recurring action starts and stops.
Cron expressions use Universal Coordinated Time (UTC) by default.
StartTime
The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, "2021-06-01T00:00:00Z"
).
public virtual string? StartTime { get; set; }
Property Value
Remarks
If you specify Recurrence
and StartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
TimeZone
Specifies the time zone for a cron expression.
public virtual string? TimeZone { get; set; }
Property Value
Remarks
If a time zone is not provided, UTC is used by default.
Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9
or Pacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones .
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
inspector
TreeInspector- tree inspector to collect and process attributes.
RenderProperties(IDictionary<string, object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
props
IDictionary<string, object>