Class CfnScheduledAction
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::AutoScaling::ScheduledAction
.
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 .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.autoscaling.*; CfnScheduledAction cfnScheduledAction = CfnScheduledAction.Builder.create(this, "MyCfnScheduledAction") .autoScalingGroupName("autoScalingGroupName") // the properties below are optional .desiredCapacity(123) .endTime("endTime") .maxSize(123) .minSize(123) .recurrence("recurrence") .startTime("startTime") .timeZone("timeZone") .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionCfnScheduledAction
(Construct scope, String id, CfnScheduledActionProps props) Create a newAWS::AutoScaling::ScheduledAction
.protected
CfnScheduledAction
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnScheduledAction
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of a scheduled action.The name of the Auto Scaling group.The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.The date and time for the recurring schedule to end, in UTC.The maximum size of the Auto Scaling group.The minimum size of the Auto Scaling group.The recurring schedule for this action.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"
).Specifies the time zone for a cron expression.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAutoScalingGroupName
(String value) The name of the Auto Scaling group.void
setDesiredCapacity
(Number value) The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.void
setEndTime
(String value) The date and time for the recurring schedule to end, in UTC.void
setMaxSize
(Number value) The maximum size of the Auto Scaling group.void
setMinSize
(Number value) The minimum size of the Auto Scaling group.void
setRecurrence
(String value) The recurring schedule for this action.void
setStartTime
(String value) 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"
).void
setTimeZone
(String value) Specifies the time zone for a cron expression.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnScheduledAction
protected CfnScheduledAction(software.amazon.jsii.JsiiObjectRef objRef) -
CfnScheduledAction
protected CfnScheduledAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnScheduledAction
@Stability(Stable) public CfnScheduledAction(@NotNull Construct scope, @NotNull String id, @NotNull CfnScheduledActionProps props) Create a newAWS::AutoScaling::ScheduledAction
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrScheduledActionName
Returns the name of a scheduled action. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getAutoScalingGroupName
The name of the Auto Scaling group. -
setAutoScalingGroupName
The name of the Auto Scaling group. -
getDesiredCapacity
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.It can scale beyond this capacity if you add more scaling conditions.
You must specify at least one of the following properties:
MaxSize
,MinSize
, orDesiredCapacity
. -
setDesiredCapacity
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.It can scale beyond this capacity if you add more scaling conditions.
You must specify at least one of the following properties:
MaxSize
,MinSize
, orDesiredCapacity
. -
getEndTime
The date and time for the recurring schedule to end, in UTC.For example,
"2021-06-01T00:00:00Z"
. -
setEndTime
The date and time for the recurring schedule to end, in UTC.For example,
"2021-06-01T00:00:00Z"
. -
getMaxSize
The maximum size of the Auto Scaling group. -
setMaxSize
The maximum size of the Auto Scaling group. -
getMinSize
The minimum size of the Auto Scaling group. -
setMinSize
The minimum size of the Auto Scaling group. -
getRecurrence
The recurring schedule for this action.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
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops.Cron expressions use Universal Coordinated Time (UTC) by default.
-
setRecurrence
The recurring schedule for this action.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
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops.Cron expressions use Universal Coordinated Time (UTC) by default.
-
getStartTime
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"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence. -
setStartTime
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"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence. -
getTimeZone
Specifies the time zone for a cron expression.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
orPacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones . -
setTimeZone
Specifies the time zone for a cron expression.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
orPacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones .
-