Search code examples
amazon-web-servicesamazon-elastic-beanstalk

How do I wait until AWS ElasticBeanstalk has finished updating the environment during CI/CD?


I'm learning about CI/CD and currently trying to deploy an app (webapp) and a server.

In my CircleCI pipeline, I do the following:

Build WebApp -> Build Server -> Deploy Server -> Deploy WebApp

For deploying the EB application to the environment I'm using the AWS CLI (I could use EB but I'm exploring the regular CLI).

When I execute:

aws elasticbeanstalk update-environment --environment-name my-env \
--version-label my-app-version-2

it outputs automatically and continues to the next step. The issue, I want to be sure that everything in EB finishes before moving to the next step in the pipeline.

I could use a wait function or timer, but, I'd prefer if there's a way to keep the job running until EB finishes instead of returning.


Solution

  • wait function or timer

    Yes, this is what you have to use.

    In fact AWS CLI provides a built-in waiter for that: [environment-updated (v1 / v2)].

    You don't have to program your own wait function or timer as you can just use the one provided by AWS.