Search code examples
amazon-web-servicesdockeraws-step-functionsaws-batch

Docker image in AWS Step Functions


Let's suppose I have an AWS Step function, a state of which is a Batch Job, associated with a Docker image.

  1. Is there more efficient way to associate a Docker image with a state, instead of using a Batch Job (arn:aws:states:::batch:submitJob.sync)? Creating an activity looks too complex.

  2. Is there any realistic way to exchange data between such "dockerized" states, except AWS-based file storages, object DBs, Docker volumes sharing on a separate instance? For example transferring STDOUT content of containerized apps between states?

  3. How application-level errors can be transferred(reported) from Docker container to the corresponding state to invalidate it, mark it as "failed"? Does that depend on the app's return value?


Solution

  • I use ECS Fargate in step functions which allows you to focus on the Container level (a container will be launched and executed for your task).

    When you say exchange data are you referring to a simple JSON document vs a large file? If the simple JSON document is what you want you can use. This should help explain that: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html.

    If theres an application error I would generally set an exit code with 0 being successful and other numbers being unsuccessful.

    Hope this helps