LoginSignup
1
0

More than 3 years have passed since last update.

【AWS】Auroraオートスケール:④Cron式スケジュール変更

Last updated at Posted at 2021-01-08

はじめに

Auroraのオートスケールを記事にしたいと思います、長いのでシリーズ記事とします

  1. 【AWS】Auroraオートスケール:①オートスケール概要
  2. 【AWS】Auroraオートスケール:②オートスケール設定
  3. 【AWS】Auroraオートスケール:③Cron式スケジュール設定
  4. 【AWS】Auroraオートスケール:④Cron式スケジュール変更  ※現在の記事
  5. 【AWS】Auroraオートスケール:⑤カスタムメトリクスでリードレプリカ数経過観察
  6. 【AWS】Auroraオートスケール:⑥チューニング・ブラッシュアップ等

Aurora Auto ScalingのCron式スケジュール設定変更

前回ではAuroraオートスケールに対してCron式スケジュールの設定を行いました。
Cron式スケジュールの修正や削除を行いたい際のコマンドを記載いたします。
image.png

前回設定したCron式スケジュールを修正する際は「scalable-target-action」コマンドを変更したコマンドを実行するだけでOKです
※「scheduled-action-name」がキーとなっています
【前回のコマンド】

aws --region ap-northeast-1 application-autoscaling put-scheduled-action \
--service-namespace rds \
--schedule "cron(0 8 * * ? *)" \
--scheduled-action-name 'test-aurora-cluster-schedule' \
--resource-id cluster:test-aurora-cluster \
--scalable-dimension rds:cluster:ReadReplicaCount \
--scalable-target-action 'MinCapacity=5,MaxCapacity=10'

【修正コマンド】

aws --region ap-northeast-1 application-autoscaling put-scheduled-action \
--service-namespace rds \
--schedule "cron(0 9 * * ? *)" \  #18時へ変更
--scheduled-action-name 'test-aurora-cluster-schedule' \
--resource-id cluster:test-aurora-cluster \
--scalable-dimension rds:cluster:ReadReplicaCount \
--scalable-target-action 'MinCapacity=4,MaxCapacity=7'  #最小4台、最大7台へ変更

確認実行結果

[root@xxxx-server ~]# aws --region ap-northeast-1 application-autoscaling describe-scheduled-actions --service-namespace rds  --resource-id cluster:test-aurora-cluster
{
    "ScheduledActions": [
        {
            "ScheduledActionName": "test-aurora-cluster-schedule",
            "ScheduledActionARN": "arn:aws:autoscaling:ap-northeast-1:xxxxxxxxxxxx:scheduledAction:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:resource/rds/cluster:test-aurora-cluster:scheduledActionName/test-aurora-cluster-schedule",
            "ServiceNamespace": "rds",
            "Schedule": "cron(0 9 * * ? *)",
            "ResourceId": "cluster:test-aurora-cluster",
            "ScalableDimension": "rds:cluster:ReadReplicaCount",
            "ScalableTargetAction": {
                "MinCapacity": 4,
                "MaxCapacity": 7
            },
            "CreationTime": "2020-11-xxTxx:xx:xx.840000+00:00"
        }
    ]
}
[root@xxxx-server ~]#

Cron式スケジュールを削除してみる

下記コマンドを実行し、Cron式スケジュールを削除します

aws --region ap-northeast-1 application-autoscaling delete-scheduled-action \
--service-namespace rds \
--scheduled-action-name 'test-aurora-cluster-schedule' \
--resource-id cluster:test-aurora-cluster \
--scalable-dimension rds:cluster:ReadReplicaCount

実行結果

[root@xxxx-server ~]# aws --region ap-northeast-1 application-autoscaling delete-scheduled-action \
> --service-namespace rds \
> --scheduled-action-name 'test-aurora-cluster-schedule' \
> --resource-id cluster:test-aurora-cluster \
> --scalable-dimension rds:cluster:ReadReplicaCount

削除されている事を確認

[root@xxxx-server ~]# aws --region ap-northeast-1 application-autoscaling describe-scheduled-actions --service-namespace rds  --resource-id cluster:test-aurora-cluster
{
    "ScheduledActions": []
}
[root@xxxx-server ~]#

Cron式スケジュールの追加・修正・削除についての説明は以上で完了です
負荷が高まる時間帯に設定するのも良いですが、長期休暇時には少しリードレプリカ台数を増やす対応を取るのも、安心を得られて良いと思います

次回

5. 【AWS】Auroraオートスケール:⑤カスタムメトリクスでリードレプリカ数経過観察

参考

Aurora レプリカでの Amazon Aurora Auto Scaling の使用

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0