Express Preview Publish

Low-latency express path for publishing trailer and preview clips. Stamps request metadata, immediately screens for moderation violations, and if cleared fast-tracks the content to a CDN edge publish with a short propagation Wait before completing.
{
  "Comment": "Express preview publish: fast-path (EXPRESS workflow) for publishing trailers and preview clips. Runs moderation only (no transcode), then publishes immediately. Optimized for low-latency preview delivery.",
  "StartAt": "SetRequestMeta",
  "States": {
    "SetRequestMeta": {
      "Type": "Pass",
      "Parameters": {
        "contentId.$": "$.contentId",
        "contentType.$": "$.contentType",
        "previewUrl.$": "$.previewUrl",
        "requestedBy.$": "$.requestedBy",
        "expedited": true,
        "workflow": "EXPRESS_PREVIEW"
      },
      "Next": "ModerationScreen"
    },
    "ModerationScreen": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${ContentModerationFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.moderation",
      "Retry": [
        {
          "ErrorEquals": [
            "Lambda.ServiceException",
            "Lambda.AWSLambdaException",
            "Lambda.SdkClientException"
          ],
          "IntervalSeconds": 1,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "ModerationError"
        }
      ],
      "Next": "IsViolation"
    },
    "IsViolation": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.moderation.Payload.isViolation",
          "BooleanEquals": false,
          "Next": "PublishPreview"
        }
      ],
      "Default": "ModerationBlocked"
    },
    "PublishPreview": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${PublishContentFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.publish",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 1,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "PublishError"
        }
      ],
      "Next": "PropagationWait"
    },
    "PropagationWait": {
      "Type": "Wait",
      "Comment": "Short wait for CDN propagation before confirming the preview is live.",
      "Seconds": 2,
      "Next": "PreviewLive"
    },
    "PreviewLive": {
      "Type": "Succeed"
    },
    "ModerationBlocked": {
      "Type": "Fail",
      "Error": "ModerationViolation",
      "Cause": "Preview content failed moderation screening and cannot be published"
    },
    "ModerationError": {
      "Type": "Fail",
      "Error": "ModerationError",
      "Cause": "Moderation lambda encountered an unexpected error"
    },
    "PublishError": {
      "Type": "Fail",
      "Error": "PublishError",
      "Cause": "Publish lambda encountered an unexpected error"
    }
  }
}
JSON
Expand
100%

Entertainment teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.

Free Trial