Scheduled scaling
Scaling based on a schedule enables you to scale your application in response to predictable changes in demand. To use scheduled scaling, you create scheduled actions, which tell ElastiCache (Redis OSS) to perform scaling activities at specific times. When you create a scheduled action, you specify an existing ElastiCache (Redis OSS) cluster, when the scaling activity should occur, minimum capacity, and maximum capacity. You can create scheduled actions that scale one time only or that scale on a recurring schedule.
You can only create a scheduled action for ElastiCache (Redis OSS) clusters that already exist. You can't create a scheduled action at the same time that you create a cluster.
For more information on terminology for scheduled action creation, management, and deletion, see Commonly used commands for scheduled action creation, management, and deletion
To create on a recurring schedule:
-
Sign in to the Amazon Web Services Management Console and open the Amazon ElastiCache console at https://console.amazonaws.cn/elasticache/
. -
In the navigation pane, choose Redis OSS.
-
Choose the cluster that you want to add a policy for.
-
Choose the Manage Auto Scaling policie from the Actions dropdown.
-
Choose the Auto Scaling policies tab.
-
In the Auto scaling policies section, the Add Scaling policy dialog box appears. Choose Scheduled scaling.
-
For Policy Name, enter the policy name.
-
For Scalable Dimension, choose Shards.
-
For Target Shards, choose the value.
-
For Recurrence, choose Recurring.
-
For Frequency, choose the respective value.
-
For Start Date and Start time, choose the time from when the policy will go into effect.
-
Choose Add Policy.
To create a one-time scheduled action:
-
Sign in to the Amazon Web Services Management Console and open the Amazon ElastiCache console at https://console.amazonaws.cn/elasticache/
. -
In the navigation pane, choose Redis OSS.
-
Choose the cluster that you want to add a policy for.
-
Choose the Manage Auto Scaling policie from the Actions dropdown.
-
Choose the Auto Scaling policies tab.
-
In the Auto scaling policies section, the Add Scaling policy dialog box appears. Choose Scheduled scaling.
-
For Policy Name, enter the policy name.
-
For Scalable Dimension, choose Shards.
-
For Target Shards, choose the value.
-
For Recurrence, choose One Time.
-
For Start Date and Start time, choose the time from when the policy will go into effect.
-
For End Date choose the date until when the policy would be in effect.
-
Choose Add Policy.
To delete a scheduled action
-
Sign in to the Amazon Web Services Management Console and open the Amazon ElastiCache console at https://console.amazonaws.cn/elasticache/
. -
In the navigation pane, choose Redis OSS.
-
Choose the cluster that you want to add a policy for.
-
Choose the Manage Auto Scaling policie from the Actions dropdown.
-
Choose the Auto Scaling policies tab.
-
In the Auto scaling policies section, choose the auto scaling policy, and then choose Delete from the Actions dialog.
To manage scheduled scaling using the Amazon CLI
Use the following application-autoscaling APIs:
Use Amazon CloudFormation to create a scheduled action
This snippet shows how to create a target tracking policy and apply it to an
AWS::ElastiCache::ReplicationGroup resource using the AWS::ApplicationAutoScaling::ScalableTarget resource. It uses the
Fn::Join and Ref intrinsic functions to construct the ResourceId
property with the logical name of the
AWS::ElastiCache::ReplicationGroup
resource that is specified
in the same template.
ScalingTarget: Type: 'AWS::ApplicationAutoScaling::ScalableTarget' Properties: MaxCapacity: 3 MinCapacity: 1 ResourceId: !Sub replication-group/${logicalName} ScalableDimension: 'elasticache:replication-group:NodeGroups' ServiceNamespace: elasticache RoleARN: !Sub "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/elasticache.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ElastiCacheRG" ScheduledActions: - EndTime: '2020-12-31T12:00:00.000Z' ScalableTargetAction: MaxCapacity: '5' MinCapacity: '2' ScheduledActionName: First Schedule: 'cron(0 18 * * ? *)'