AWS Step Functions wait for CodeBuild to finish

Viewed 348

How to wait for a CodeBuild to finish inside a Step Functions state machine?

The only wait I can think of right now is with a loop and a timer, like the flow bellow, but is it the only way to do it? Isn't there a "WaitForBuild" action or something like that?

enter image description here

Typo: BatchGetBuildBatches should be BatchGetBuilds.

1 Answers

I found out how to do this, just add .sync to the end of the resource arn of your CodeBuild start in your state machine json, like this:

{
  "Comment": "A description of my state machine",
  "StartAt": "CodeBuild StartBuild",
  "States": {
    "CodeBuild StartBuild": {
      "Type": "Task",
      "Resource": "arn:aws:states:::codebuild:startBuild.sync", // <--- here
      "Parameters": {
        "ProjectName": "arn:aws:codebuild:sa-east-1:############:project/test"
      },
      "End": true
    }
  }
}
Related