0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

step function test

Last updated at Posted at 2025-09-18
{
  "Comment": "3:00 -> 4:00 -> 5:00(速報/確報並行)。各ステップは時間到達かつ直前ステップ完了が条件。",
  "StartAt": "Job1_Run",
  "States": {
    "Job1_Run": {
      "Type": "Task",
      "Resource": "arn:aws:states:::ecs:runTask.sync",
      "Parameters": {
        "Cluster": "<ECS_CLUSTER_ARN>",
        "TaskDefinition": "<TASK_DEF_ARN>",
        "LaunchType": "FARGATE",
        "NetworkConfiguration": {
          "AwsvpcConfiguration": {
            "Subnets": ["<SUBNET_ID_1>", "<SUBNET_ID_2>"],
            "SecurityGroups": ["<SG_ID>"],
            "AssignPublicIp": "DISABLED"
          }
        },
        "Overrides": {
          "ContainerOverrides": [{
            "Name": "sm-batch",
            "Command": [
              "java","-jar","app.jar",
              "--batch.run=SM-BAT-01-001",
              "--batch.user=SM",
              "--batch.date=2025-08-16T03:00:00+09:00"
            ]
          }]
        }
      },
      "Next": "Gate_0400"
    },

    "Gate_0400": {
      "Type": "Task",
      "Resource": "<WAIT_LAMBDA_ARN>",
      "Parameters": { "notBefore": "04:00", "timezone": "Asia/Tokyo" },
      "ResultPath": "$.w4",
      "Next": "MaybeWait4"
    },
    "MaybeWait4": {
      "Type": "Choice",
      "Choices": [{ "Variable": "$.w4.waitSeconds", "NumericGreaterThan": 0, "Next": "Sleep4" }],
      "Default": "Job2_Run"
    },
    "Sleep4": { "Type": "Wait", "SecondsPath": "$.w4.waitSeconds", "Next": "Job2_Run" },

    "Job2_Run": {
      "Type": "Task",
      "Resource": "arn:aws:states:::ecs:runTask.sync",
      "Parameters": {
        "Cluster": "<ECS_CLUSTER_ARN>",
        "TaskDefinition": "<TASK_DEF_ARN>",
        "LaunchType": "FARGATE",
        "NetworkConfiguration": {
          "AwsvpcConfiguration": {
            "Subnets": ["<SUBNET_ID_1>", "<SUBNET_ID_2>"],
            "SecurityGroups": ["<SG_ID>"],
            "AssignPublicIp": "DISABLED"
          }
        },
        "Overrides": {
          "ContainerOverrides": [{
            "Name": "sm-batch",
            "Command": [
              "java","-jar","app.jar",
              "--batch.run=SM-BAT-03-001",
              "--batch.user=SM",
              "--batch.date=2025-08-16T04:00:00+09:00"
            ]
          }]
        }
      },
      "Next": "Gate_0500"
    },

    "Gate_0500": {
      "Type": "Task",
      "Resource": "<WAIT_LAMBDA_ARN>",
      "Parameters": { "notBefore": "05:00", "timezone": "Asia/Tokyo" },
      "ResultPath": "$.w5",
      "Next": "MaybeWait5"
    },
    "MaybeWait5": {
      "Type": "Choice",
      "Choices": [{ "Variable": "$.w5.waitSeconds", "NumericGreaterThan": 0, "Next": "Sleep5" }],
      "Default": "FiveOClockParallel"
    },
    "Sleep5": { "Type": "Wait", "SecondsPath": "$.w5.waitSeconds", "Next": "FiveOClockParallel" },

    "FiveOClockParallel": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "Job3_Run_速報",
          "States": {
            "Job3_Run_速報": {
              "Type": "Task",
              "Resource": "arn:aws:states:::ecs:runTask.sync",
              "Parameters": {
                "Cluster": "<ECS_CLUSTER_ARN>",
                "TaskDefinition": "<TASK_DEF_ARN>",
                "LaunchType": "FARGATE",
                "NetworkConfiguration": {
                  "AwsvpcConfiguration": {
                    "Subnets": ["<SUBNET_ID_1>", "<SUBNET_ID_2>"],
                    "SecurityGroups": ["<SG_ID>"],
                    "AssignPublicIp": "DISABLED"
                  }
                },
                "Overrides": {
                  "ContainerOverrides": [{
                    "Name": "sm-batch",
                    "Command": [
                      "java","-jar","app.jar",
                      "--batch.run=SM-REP-FAST",
                      "--batch.user=REPORT-1",
                      "--batch.date=2025-08-16T05:00:00+09:00",
                      "--batch.reportType=速報"
                    ]
                  }]
                }
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "Job4_Run_確報",
          "States": {
            "Job4_Run_確報": {
              "Type": "Task",
              "Resource": "arn:aws:states:::ecs:runTask.sync",
              "Parameters": {
                "Cluster": "<ECS_CLUSTER_ARN>",
                "TaskDefinition": "<TASK_DEF_ARN>",
                "LaunchType": "FARGATE",
                "NetworkConfiguration": {
                  "AwsvpcConfiguration": {
                    "Subnets": ["<SUBNET_ID_1>", "<SUBNET_ID_2>"],
                    "SecurityGroups": ["<SG_ID>"],
                    "AssignPublicIp": "DISABLED"
                  }
                },
                "Overrides": {
                  "ContainerOverrides": [{
                    "Name": "sm-batch",
                    "Command": [
                      "java","-jar","app.jar",
                      "--batch.run=SM-REP-FINAL",
                      "--batch.user=REPORT-2",
                      "--batch.date=2025-08-16T05:00:00+09:00",
                      "--batch.reportType=確報"
                    ]
                  }]
                }
              },
              "End": true
            }
          }
        }
      ],
      "End": true
    }
  }
}


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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?