最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - aws scheduler get-schedule returning unusual ScheduleExpression - Stack Overflow

programmeradmin1浏览0评论

I'm using AWS CloudShell to retrieve the configuration of my AWS EventBridge Schedule but this is returning an unusual ScheduleExpression causing problems downstream.

Commands I'm running in AWS CloudShell:

TARGET=$(aws scheduler get-schedule --name MY-SCHEDULE-NAME)  
echo $TARGET

This returns

{
  "ActionAfterCompletion": "NONE",
  "Arn": "arn:aws:scheduler:eu-west-1:AWS-ID:schedule/default/MY-SCHEDULE-NAME",
  "CreationDate": "2024-11-21T17:12:01.720000+00:00",
  "Description": "MY-SCHEDULE-NAME",
  "FlexibleTimeWindow": {
    "Mode": "OFF"
  },
  "GroupName": "default",
  "LastModificationDate": "2024-11-21T17:12:01.720000+00:00",
  "Name": "MY-SCHEDULE-NAME",
  "ScheduleExpression": "cron(00 05 ? new_target.json task-def.json 1 *)",
  "ScheduleExpressionTimezone": "Europe/Amsterdam",
  "State": "ENABLED",
  "Target": {
    "Arn": "arn:aws:ecs:eu-west-1:AWS-ID:cluster/MY-CLUSTER",
    "EcsParameters": {
      "EnableECSManagedTags": false,
      "EnableExecuteCommand": false,
      "LaunchType": "FARGATE",
      "NetworkConfiguration": {
        "awsvpcConfiguration": {
          "AssignPublicIp": "DISABLED",
          "SecurityGroups": [
            "sg-123"
          ],
          "Subnets": [
            "subnet-123",
            "subnet-123",
            "subnet-123"
          ]
        }
      },
      "PlatformVersion": "LATEST",
      "PropagateTags": "TASK_DEFINITION",
      "ReferenceId": "MY-TASK-DEFINITION",
      "TaskCount": 1,
      "TaskDefinitionArn": "arn:aws:ecs:eu-west-1:AWS-ID:task-definition/MY-TASK-DEFINITION-td:1"
    },
    "Input": "{\"containerOverrides\":[{\"environment\":[{\"name\":\"refresh_type\",\"value\":\"weekly\"}],\"name\":\"MY-TASK-DEFINITION\"}]}",
    "RetryPolicy": {
      "MaximumEventAgeInSeconds": 86400,
      "MaximumRetryAttempts": 185
    },
    "RoleArn": "arn:aws:iam::AWS-ID:role/MY-SCHEDULE-NAME-schedule-exec-role"
  }
}

As you can see, the ScheduleExpression is "cron(00 05 ? new_target.json task-def.json 1 *)". However, in the AWS Console, the Schedule is 00 05 ? * 1 *. I have no idea where the new_target.json task-def.json is coming from. I've tried editing the Schedule in Terraform and in the UI but no change in the response from AWS CloudShell. Do you have any idea what could be causing this?

Edit: It seems that the first * is causing this. When I edit the cron to 00 06 1 1 ? * it works as expected. However, when I change it to 00 06 1 * ? * it returns new_target.json task-def.json.

发布评论

评论列表(0)

  1. 暂无评论