LoginSignup
0
0

More than 3 years have passed since last update.

AWS Application Autoscaling の Scheduled Action の cron式は意外とValidationが緩いので注意

Last updated at Posted at 2019-06-05

ルールのスケジュール式 - Amazon CloudWatch Events

本来こう書きたかった

cron(0 12 * * ? *)

ところを、こう書いてしまっていました

cron(0 12 * * * ? *)

すると、

  • 毎日12時(UTCなので日本時間で21時)

に発火してほしいアクションが

  • 毎時12分

に発火してしまっていました。

つまり

余り?? 曜日
0 12 * * * ? *

と解釈されていたと思われます。曜日か日に?を入れないとValidationExceptionが発生して登録できないので割としっかり書式のValidationされているのかと思いきや、意外と緩いみたい。

cron(0 12 * * * ? * *)

というのも登録できました。

aws application-autoscaling describe-scheduled-actions --service-namespace ecs
{
    "ScheduledActions": [
        {
            "ScheduledActionName": "test",
            "ScheduledActionARN": "(snip)",
            "ServiceNamespace": "ecs",
            "Schedule": "cron(0 12 * * * ? * *)",
            "ResourceId": "(snip)",
            "ScalableDimension": "ecs:service:DesiredCount",
            "ScalableTargetAction": {
                "MinCapacity": 1,
                "MaxCapacity": 2
            },
            "CreationTime": 1559715911.616
        }
    ]
}

この書式だとどう動くのかは検証していません...

0
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
0
0