@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-28T21:34:27.188Z") public class CfnScheduledAction extends CfnResource implements IInspectable
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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnScheduledAction.Builder
A fluent builder for
CfnScheduledAction . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnScheduledAction(Construct scope,
java.lang.String id,
CfnScheduledActionProps props)
Create a new `AWS::AutoScaling::ScheduledAction`.
|
protected |
CfnScheduledAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnScheduledAction(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrScheduledActionName()
Returns the name of a scheduled action.
|
java.lang.String |
getAutoScalingGroupName()
The name of the Auto Scaling group.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Number |
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.
|
java.lang.String |
getEndTime()
The date and time for the recurring schedule to end, in UTC.
|
java.lang.Number |
getMaxSize()
The maximum size of the Auto Scaling group.
|
java.lang.Number |
getMinSize()
The minimum size of the Auto Scaling group.
|
java.lang.String |
getRecurrence()
The recurring schedule for this action.
|
java.lang.String |
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"` ).
|
java.lang.String |
getTimeZone()
Specifies the time zone for a cron expression.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAutoScalingGroupName(java.lang.String value)
The name of the Auto Scaling group.
|
void |
setDesiredCapacity(java.lang.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(java.lang.String value)
The date and time for the recurring schedule to end, in UTC.
|
void |
setMaxSize(java.lang.Number value)
The maximum size of the Auto Scaling group.
|
void |
setMinSize(java.lang.Number value)
The minimum size of the Auto Scaling group.
|
void |
setRecurrence(java.lang.String value)
The recurring schedule for this action.
|
void |
setStartTime(java.lang.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(java.lang.String value)
Specifies the time zone for a cron expression.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnScheduledAction(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnScheduledAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnScheduledAction(Construct scope, java.lang.String id, CfnScheduledActionProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrScheduledActionName()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getAutoScalingGroupName()
public void setAutoScalingGroupName(java.lang.String value)
public java.lang.Number getDesiredCapacity()
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
.
public void setDesiredCapacity(java.lang.Number value)
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
.
public java.lang.String getEndTime()
For example, "2021-06-01T00:00:00Z"
.
public void setEndTime(java.lang.String value)
For example, "2021-06-01T00:00:00Z"
.
public java.lang.Number getMaxSize()
public void setMaxSize(java.lang.Number value)
public java.lang.Number getMinSize()
public void setMinSize(java.lang.Number value)
public java.lang.String getRecurrence()
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.
public void setRecurrence(java.lang.String value)
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.
public java.lang.String getStartTime()
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.
public void setStartTime(java.lang.String value)
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.
public java.lang.String getTimeZone()
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 .
public void setTimeZone(java.lang.String value)
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 .