

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# スケジュールに基づくスケーリング
<a name="AutoScaling-with-Scheduled-Scaling-Replicas"></a>

スケジュールに基づくスケーリングにより、予測可能な需要の変化に応じてアプリケーションをスケーリングできます。スケジュールに基づくスケーリングを使用するには、指定された時間にスケーリングアクティビティを行うよう Valkey と Redis OSS に対応した ElastiCache に指示する、スケジュールされたアクションを作成します。スケジュールされたアクションを作成するときに、既存の ElastiCache クラスター、スケーリングアクティビティを発生させるタイミング、最小容量、最大容量を指定します。スケジュールされたアクションは、一度だけスケールする、または定期的なスケジュールに従ってスケールするものを作成できます。

 スケジュールされたアクションは、既存の ElastiCache クラスターに対してのみ作成できます。クラスターの作成と同時にスケジュールされたアクションを作成することはできません。

スケジュールされたアクションの作成、管理、削除に関する用語の詳細については、「[スケジュールされたアクションの作成、管理、削除に一般的に使用されるコマンド](https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-scheduled-scaling.html#scheduled-scaling-commonly-used-commands)」を参照してください。

**1 回のスケジュールされたアクションを作成するには**

シャードのディメンションと同様です。「[スケジュールに基づくスケーリング](AutoScaling-with-Scheduled-Scaling-Shards.md)」を参照してください。

**スケジュールされたアクションを削除するには**

シャードのディメンションと同様です。「[スケジュールに基づくスケーリング](AutoScaling-with-Scheduled-Scaling-Shards.md)」を参照してください。

** AWS CLI を使用してスケジュールされたスケーリングを管理するには**

次のアプリケーション自動スケーリング API を使用します。
+ put-scheduled-action[https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scheduled-action.html](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scheduled-action.html) 
+ describe-scheduled-actions[https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/describe-scheduled-actions.html](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/describe-scheduled-actions.html) 
+ delete-scheduled-action[https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/delete-scheduled-action.html](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/delete-scheduled-action.html) 

## CloudFormation を使用して Auto Scaling ポリシーを作成する
<a name="AutoScaling-with-Cloudformation-Update-Action"></a>

このスニペットでは、スケジュールに基づくアクションを作成し、[AWS::ApplicationAutoScaling::ScalableTarget](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html) リソースを使用して、そのアクションを [AWS::ElastiCache::ReplicationGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html) リソースに適用する方法を示しています。また、[Fn::Join](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-join.html) および [Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) 組み込み関数を使用して、同じテンプレートで指定された `AWS::ElastiCache::ReplicationGroup` リソースの論理名で `ResourceId` プロパティを作成します。

```
ScalingTarget:
   Type: 'AWS::ApplicationAutoScaling::ScalableTarget'
   Properties:
     MaxCapacity: 0
     MinCapacity: 0
     ResourceId: !Sub replication-group/${logicalName}
     ScalableDimension: 'elasticache:replication-group:Replicas'
     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 * * ? *)'
```