Home > other >  Wait for an operation to finish using CLI
Wait for an operation to finish using CLI

Time:11-02

I have CodeBuild running "aws apprunner start-deployment" but I don't want code build to finish until the deployment is done. In the docs, it says ...

This is an asynchronous operation. On a successful call, you can use the returned OperationId and the ListOperations call to track the operation’s progress.

but I'm not sure exactly how to do that.

CodePudding user response:

Assign the output to a variable. Then use the list-operations operation to see if it's still running.

id=$(aws apprunner start-deployment)
while aws apprunner list-operations | grep -q "$id"; do
    sleep 1
done
  • Related