garethb
garethb

Reputation: 4051

AWS CLI get status of deployment after deploying to elastic beanstalk

The last line of my deployment task using the AWS CLI is

aws elasticbeanstalk update-environment --application-name DevApi --environment-name Dev --version-label v2

How can I check that the deployment of v2 was successful? At the moment I have another browser window open console.aws.amazon.com/elasticbeanstalk/ and check there. But there has to be a better way to automate it as part of my deployment by adding another step (cli command?) so I only need to check the deployment output?

EDIT: I should also mention I am running a Windows Elastic Beanstalk instance.

Upvotes: 0

Views: 1054

Answers (1)

Madhukar Mohanraju
Madhukar Mohanraju

Reputation: 2863

One way I can think of is to check the EBS Health Reports.

If you are using Basic Monitoring, use the below cli:

aws elasticbeanstalk describe-environments --application-name DevApi  --environment-name Dev --query 'Environments[*].{Status: Status,Health: Health} --output json'

Sample output:

[
    {
        "Status": "Ready",
        "Health": "Green"
    }
]

For more info about each indicator, read Basic Health Reporting.

If you are using Enhanced Monitoring (for extra cost), then there is an additional parameter available which makes it much more clear.

aws elasticbeanstalk describe-environments --application-name DevApi  --environment-name Dev --query 'Environments[*].{Status: Status,Health: Health,HealthStatus: HealthStatus} --output json'

Sample Output:

[
    {
        "Status": "Ready",
        "HealthStatus": "Ok",
        "Health": "Green"
    }
]

Once the above status is reached, you can conclude the deployment is complete and is healthy. If the HealthStatus is Info and Health is Green, It indicates An operation is in progress on an instance (or) on several instances in an environment. Example: A new application version is being deployed to running instances.

For more info about each health indicator, do read Enhanced Health reporting.

Upvotes: 3

Related Questions