ElasticBeanstalk / Client / describe_environment_health

describe_environment_health#

ElasticBeanstalk.Client.describe_environment_health(**kwargs)#

Returns information about the overall health of the specified environment. The DescribeEnvironmentHealth operation is only available with AWS Elastic Beanstalk Enhanced Health.

See also: AWS API Documentation

Request Syntax

response = client.describe_environment_health(
    EnvironmentName='string',
    EnvironmentId='string',
    AttributeNames=[
        'Status'|'Color'|'Causes'|'ApplicationMetrics'|'InstancesHealth'|'All'|'HealthStatus'|'RefreshedAt',
    ]
)
Parameters:
  • EnvironmentName (string) –

    Specify the environment by name.

    You must specify either this or an EnvironmentName, or both.

  • EnvironmentId (string) –

    Specify the environment by ID.

    You must specify either this or an EnvironmentName, or both.

  • AttributeNames (list) –

    Specify the response elements to return. To retrieve all attributes, set to All. If no attribute names are specified, returns the name of the environment.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'EnvironmentName': 'string',
    'HealthStatus': 'string',
    'Status': 'Green'|'Yellow'|'Red'|'Grey',
    'Color': 'string',
    'Causes': [
        'string',
    ],
    'ApplicationMetrics': {
        'Duration': 123,
        'RequestCount': 123,
        'StatusCodes': {
            'Status2xx': 123,
            'Status3xx': 123,
            'Status4xx': 123,
            'Status5xx': 123
        },
        'Latency': {
            'P999': 123.0,
            'P99': 123.0,
            'P95': 123.0,
            'P90': 123.0,
            'P85': 123.0,
            'P75': 123.0,
            'P50': 123.0,
            'P10': 123.0
        }
    },
    'InstancesHealth': {
        'NoData': 123,
        'Unknown': 123,
        'Pending': 123,
        'Ok': 123,
        'Info': 123,
        'Warning': 123,
        'Degraded': 123,
        'Severe': 123
    },
    'RefreshedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    Health details for an AWS Elastic Beanstalk environment.

    • EnvironmentName (string) –

      The environment’s name.

    • HealthStatus (string) –

      The health status of the environment. For example, Ok.

    • Status (string) –

      The environment’s operational status. Ready, Launching, Updating, Terminating, or Terminated.

    • Color (string) –

      The health color of the environment.

    • Causes (list) –

      Descriptions of the data that contributed to the environment’s current health status.

      • (string) –

    • ApplicationMetrics (dict) –

      Application request metrics for the environment.

      • Duration (integer) –

        The amount of time that the metrics cover (usually 10 seconds). For example, you might have 5 requests ( request_count) within the most recent time slice of 10 seconds ( duration).

      • RequestCount (integer) –

        Average number of requests handled by the web server per second over the last 10 seconds.

      • StatusCodes (dict) –

        Represents the percentage of requests over the last 10 seconds that resulted in each type of status code response.

        • Status2xx (integer) –

          The percentage of requests over the last 10 seconds that resulted in a 2xx (200, 201, etc.) status code.

        • Status3xx (integer) –

          The percentage of requests over the last 10 seconds that resulted in a 3xx (300, 301, etc.) status code.

        • Status4xx (integer) –

          The percentage of requests over the last 10 seconds that resulted in a 4xx (400, 401, etc.) status code.

        • Status5xx (integer) –

          The percentage of requests over the last 10 seconds that resulted in a 5xx (500, 501, etc.) status code.

      • Latency (dict) –

        Represents the average latency for the slowest X percent of requests over the last 10 seconds. Latencies are in seconds with one millisecond resolution.

        • P999 (float) –

          The average latency for the slowest 0.1 percent of requests over the last 10 seconds.

        • P99 (float) –

          The average latency for the slowest 1 percent of requests over the last 10 seconds.

        • P95 (float) –

          The average latency for the slowest 5 percent of requests over the last 10 seconds.

        • P90 (float) –

          The average latency for the slowest 10 percent of requests over the last 10 seconds.

        • P85 (float) –

          The average latency for the slowest 15 percent of requests over the last 10 seconds.

        • P75 (float) –

          The average latency for the slowest 25 percent of requests over the last 10 seconds.

        • P50 (float) –

          The average latency for the slowest 50 percent of requests over the last 10 seconds.

        • P10 (float) –

          The average latency for the slowest 90 percent of requests over the last 10 seconds.

    • InstancesHealth (dict) –

      Summary health information for the instances in the environment.

      • NoData (integer) –

        Grey. AWS Elastic Beanstalk and the health agent are reporting no data on an instance.

      • Unknown (integer) –

        Grey. AWS Elastic Beanstalk and the health agent are reporting an insufficient amount of data on an instance.

      • Pending (integer) –

        Grey. An operation is in progress on an instance within the command timeout.

      • Ok (integer) –

        Green. An instance is passing health checks and the health agent is not reporting any problems.

      • Info (integer) –

        Green. An operation is in progress on an instance.

      • Warning (integer) –

        Yellow. The health agent is reporting a moderate number of request failures or other issues for an instance or environment.

      • Degraded (integer) –

        Red. The health agent is reporting a high number of request failures or other issues for an instance or environment.

      • Severe (integer) –

        Red. The health agent is reporting a very high number of request failures or other issues for an instance or environment.

    • RefreshedAt (datetime) –

      The date and time that the health information was retrieved.

Exceptions

Examples

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

response = client.describe_environment_health(
    AttributeNames=[
        'All',
    ],
    EnvironmentName='my-env',
)

print(response)

Expected Output:

{
    'ApplicationMetrics': {
        'Duration': 10,
        'Latency': {
            'P10': 0.001,
            'P50': 0.001,
            'P75': 0.002,
            'P85': 0.003,
            'P90': 0.003,
            'P95': 0.004,
            'P99': 0.004,
            'P999': 0.004,
        },
        'RequestCount': 45,
        'StatusCodes': {
            'Status2xx': 45,
            'Status3xx': 0,
            'Status4xx': 0,
            'Status5xx': 0,
        },
    },
    'Causes': [
    ],
    'Color': 'Green',
    'EnvironmentName': 'my-env',
    'HealthStatus': 'Ok',
    'InstancesHealth': {
        'Degraded': 0,
        'Info': 0,
        'NoData': 0,
        'Ok': 1,
        'Pending': 0,
        'Severe': 0,
        'Unknown': 0,
        'Warning': 0,
    },
    'RefreshedAt': datetime(2015, 8, 20, 21, 9, 18, 3, 232, 0),
    'ResponseMetadata': {
        '...': '...',
    },
}