{ "Comment": "DBダンプ取得ステートマシン", "StartAt": "params", "States": { "params": { "Comment": "パラメータ設定", "Type": "Pass", "Parameters": { "sns": { "TopicArn": "arn:aws:sns:#{REGION_AP_NORTHEAST_1}:#{AWS_ACCOUNT_ID}:mbj-notice-#{ENV_NAME}" }, "ecs": { "LaunchType": "FARGATE", "Cluster": "arn:aws:ecs:#{REGION_AP_NORTHEAST_1}:#{AWS_ACCOUNT_ID}:cluster/mbj-newdwh2021-#{ENV_NAME}-export-dbdump-ecs", "TaskDefinition": "ExportDatabaseDump", "NetworkConfiguration": { "AwsvpcConfiguration": { "Subnets": [ "#{SUBNET_PRI_1A}", "#{SUBNET_PRI_1D}" ], "SecurityGroups": [ "#{SG_ECS_ALL}", "#{SG_EXPORT_DBDUMP}" ], "AssignPublicIp": "DISABLED" } }, "Overrides": { "ContainerOverrides": [ { "Name.$": "$.InputParams.ContainerName", "Environment": [ { "Name": "DB_SCHEMA", "Value.$": "$.params.eventBridge.DB_SCHEMA" }, { "Name": "DUMP_BACKUP_BUCKET", "Value.$": "$.params.eventBridge.DUMP_BACKUP_BUCKET" } ] } ] } } }, "ResultPath": "$.params", "Next": "export-dbdump" }, "export-dbdump": { "Type": "Task", "Resource": "arn:aws:states:::ecs:runTask.sync", "Parameters": { "LaunchType.$": "$.params.ecs.LaunchType", "Cluster.$": "$.params.ecs.Cluster", "TaskDefinition.$": "$.params.ecs.TaskDefinition", "NetworkConfiguration.$": "$.params.ecs.NetworkConfiguration", "Overrides.$": "$.params.ecs.Overrides" }, "ResultPath": "$.result", "Retry": [ { "ErrorEquals": [ "States.ALL" ], "BackoffRate": 2, "IntervalSeconds": 3, "MaxAttempts": 3 } ], "Catch": [ { "ErrorEquals": [ "States.ALL" ], "Next": "ErrorEnd", "ResultPath": "$.result" } ], "Next": "NormalEnd", "Comment": "データ登録処理" }, "NormalEnd": { "Comment": "正常終了", "Type": "Succeed" }, "ErrorEnd": { "Comment": "異常終了", "Type": "Fail", "Error": "StatesError", "Cause": "StepFunctions ErrorEnd" } } }