Skip to content

/AWS1/IF_EBN=>DESCRIBEINSTANCESHEALTH()

About DescribeInstancesHealth

Retrieves detailed information about the health of instances in your Elastic Beanstalk environments. This operation requires enhanced health reporting.

This action only returns information about environments that the calling principle has IAM permissions to access. For example, consider a case where a user only has permission to access one of three environments. When the user calls this action, the response will only include the one environment that the user has permission to access instead of all three environments. If the user doesn’t have access to any of the environments an empty result is returned.

The AWSElasticBeanstalkReadOnly managed policy allows operators to view information about resources related to Elastic Beanstalk environments. For more information, see Managing Elastic Beanstalk user policies in the Elastic Beanstalk Developer Guide. For detailed instructions to attach a policy to a user or group, see the section Controlling access with managed policies in the same topic.

Method Signature

METHODS /AWS1/IF_EBN~DESCRIBEINSTANCESHEALTH
  IMPORTING
    !IV_ENVIRONMENTNAME TYPE /AWS1/EBNENVIRONMENTNAME OPTIONAL
    !IV_ENVIRONMENTID TYPE /AWS1/EBNENVIRONMENTID OPTIONAL
    !IT_ATTRIBUTENAMES TYPE /AWS1/CL_EBNINSTSHEALTHATTRS_W=>TT_INSTANCESHEALTHATTRIBUTES OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/EBNNEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ebndscinstshealthrs
  RAISING
    /AWS1/CX_EBNELASTICBEANSTALK00
    /AWS1/CX_EBNINVALIDREQUESTEX
    /AWS1/CX_EBNCLIENTEXC
    /AWS1/CX_EBNSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Optional arguments:

iv_environmentname TYPE /AWS1/EBNENVIRONMENTNAME /AWS1/EBNENVIRONMENTNAME

Specify the Elastic Beanstalk environment by name.

iv_environmentid TYPE /AWS1/EBNENVIRONMENTID /AWS1/EBNENVIRONMENTID

Specify the Elastic Beanstalk environment by ID.

it_attributenames TYPE /AWS1/CL_EBNINSTSHEALTHATTRS_W=>TT_INSTANCESHEALTHATTRIBUTES TT_INSTANCESHEALTHATTRIBUTES

Specifies the response elements you wish to receive. To retrieve all attributes, set to All. If no attribute names are specified, returns a list of instances.

iv_nexttoken TYPE /AWS1/EBNNEXTTOKEN /AWS1/EBNNEXTTOKEN

Specify the pagination token returned by a previous call.

RETURNING

oo_output TYPE REF TO /aws1/cl_ebndscinstshealthrs /AWS1/CL_EBNDSCINSTSHEALTHRS

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->describeinstanceshealth(
  it_attributenames = VALUE /aws1/cl_ebninstshealthattrs_w=>tt_instanceshealthattributes(
    ( new /aws1/cl_ebninstshealthattrs_w( |string| ) )
  )
  iv_environmentid = |string|
  iv_environmentname = |string|
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_instancehealthlist( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_instanceid = lo_row_1->get_instanceid( ).
      lv_string = lo_row_1->get_healthstatus( ).
      lv_string = lo_row_1->get_color( ).
      LOOP AT lo_row_1->get_causes( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_cause = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_launchedat = lo_row_1->get_launchedat( ).
      lo_applicationmetrics = lo_row_1->get_applicationmetrics( ).
      IF lo_applicationmetrics IS NOT INITIAL.
        lv_nullableinteger = lo_applicationmetrics->get_duration( ).
        lv_requestcount = lo_applicationmetrics->get_requestcount( ).
        lo_statuscodes = lo_applicationmetrics->get_statuscodes( ).
        IF lo_statuscodes IS NOT INITIAL.
          lv_nullableinteger = lo_statuscodes->get_status2xx( ).
          lv_nullableinteger = lo_statuscodes->get_status3xx( ).
          lv_nullableinteger = lo_statuscodes->get_status4xx( ).
          lv_nullableinteger = lo_statuscodes->get_status5xx( ).
        ENDIF.
        lo_latency = lo_applicationmetrics->get_latency( ).
        IF lo_latency IS NOT INITIAL.
          lv_nullabledouble = lo_latency->get_p999( ).
          lv_nullabledouble = lo_latency->get_p99( ).
          lv_nullabledouble = lo_latency->get_p95( ).
          lv_nullabledouble = lo_latency->get_p90( ).
          lv_nullabledouble = lo_latency->get_p85( ).
          lv_nullabledouble = lo_latency->get_p75( ).
          lv_nullabledouble = lo_latency->get_p50( ).
          lv_nullabledouble = lo_latency->get_p10( ).
        ENDIF.
      ENDIF.
      lo_systemstatus = lo_row_1->get_system( ).
      IF lo_systemstatus IS NOT INITIAL.
        lo_cpuutilization = lo_systemstatus->get_cpuutilization( ).
        IF lo_cpuutilization IS NOT INITIAL.
          lv_nullabledouble = lo_cpuutilization->get_user( ).
          lv_nullabledouble = lo_cpuutilization->get_nice( ).
          lv_nullabledouble = lo_cpuutilization->get_system( ).
          lv_nullabledouble = lo_cpuutilization->get_idle( ).
          lv_nullabledouble = lo_cpuutilization->get_iowait( ).
          lv_nullabledouble = lo_cpuutilization->get_irq( ).
          lv_nullabledouble = lo_cpuutilization->get_softirq( ).
          lv_nullabledouble = lo_cpuutilization->get_privileged( ).
        ENDIF.
        LOOP AT lo_systemstatus->get_loadaverage( ) into lo_row_4.
          lo_row_5 = lo_row_4.
          IF lo_row_5 IS NOT INITIAL.
            lv_loadaveragevalue = lo_row_5->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
      lo_deployment = lo_row_1->get_deployment( ).
      IF lo_deployment IS NOT INITIAL.
        lv_string = lo_deployment->get_versionlabel( ).
        lv_nullablelong = lo_deployment->get_deploymentid( ).
        lv_string = lo_deployment->get_status( ).
        lv_deploymenttimestamp = lo_deployment->get_deploymenttime( ).
      ENDIF.
      lv_string = lo_row_1->get_availabilityzone( ).
      lv_string = lo_row_1->get_instancetype( ).
    ENDIF.
  ENDLOOP.
  lv_refreshedat = lo_result->get_refreshedat( ).
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.

To view environment health

The following operation retrieves health information for instances in an environment named my-env:

DATA(lo_result) = lo_client->describeinstanceshealth(
  it_attributenames = VALUE /aws1/cl_ebninstshealthattrs_w=>tt_instanceshealthattributes(
    ( new /aws1/cl_ebninstshealthattrs_w( |All| ) )
  )
  iv_environmentname = |my-env|
).