class ScheduledAction (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AutoScaling.ScheduledAction |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#ScheduledAction |
Java | software.amazon.awscdk.services.autoscaling.ScheduledAction |
Python | aws_cdk.aws_autoscaling.ScheduledAction |
TypeScript (source) | aws-cdk-lib » aws_autoscaling » ScheduledAction |
Implements
IConstruct, IDependable, IResource, IEnvironment
Define a scheduled scaling action.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';
declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
declare const schedule: autoscaling.Schedule;
const scheduledAction = new autoscaling.ScheduledAction(this, 'MyScheduledAction', {
autoScalingGroup: autoScalingGroupRef,
schedule: schedule,
// the properties below are optional
desiredCapacity: 123,
endTime: new Date(),
maxCapacity: 123,
minCapacity: 123,
startTime: new Date(),
timeZone: 'timeZone',
});
Initializer
new ScheduledAction(scope: Construct, id: string, props: ScheduledActionProps)
Parameters
- scope
Construct - id
string - props
ScheduledAction Props
Construct Props
| Name | Type | Description |
|---|---|---|
| auto | IAuto | The AutoScalingGroup to apply the scheduled actions to. |
| schedule | Schedule | When to perform this action. |
| desired | number | The new desired capacity. |
| end | date | When this scheduled action expires. |
| max | number | The new maximum capacity. |
| min | number | The new minimum capacity. |
| start | date | When this scheduled action becomes active. |
| time | string | Specifies the time zone for a cron expression. |
autoScalingGroup
Type:
IAuto
The AutoScalingGroup to apply the scheduled actions to.
schedule
Type:
Schedule
When to perform this action.
Supports cron expressions.
For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron.
desiredCapacity?
Type:
number
(optional, default: No new desired capacity.)
The new desired capacity.
At the scheduled time, set the desired capacity to the given capacity.
At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
endTime?
Type:
date
(optional, default: The rule never expires.)
When this scheduled action expires.
Warning! You should not set this field! After the scheduled end time, the AutoScaling
service will delete the ScheduledAction without CloudFormation's knowledge, and subsequent
stack deployments that try to modify or delete this ScheduledAction will fail.
maxCapacity?
Type:
number
(optional, default: No new maximum capacity.)
The new maximum capacity.
At the scheduled time, set the maximum capacity to the given capacity.
At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
minCapacity?
Type:
number
(optional, default: No new minimum capacity.)
The new minimum capacity.
At the scheduled time, set the minimum capacity to the given capacity.
At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
startTime?
Type:
date
(optional, default: The rule is activate immediately.)
When this scheduled action becomes active.
timeZone?
Type:
string
(optional, default: UTC)
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 or Pacific/Tahiti).
For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| scheduled | string | The name of the scheduled action. |
| stack | Stack | The stack in which this resource is defined. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
node
Type:
Node
The tree node.
scheduledActionName
Type:
string
The name of the scheduled action.
stack
Type:
Stack
The stack in which this resource is defined.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Override the cross-stack reference strength for this resource. |
| apply | Apply the given removal policy to this resource. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
applyCrossStackReferenceStrength(strength)
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
Parameters
- strength
Reference— - The reference strength to use for this resource.Strength
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.

.NET
Go
Java
Python
TypeScript (