describe_instances_health

describe_instances_health(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response = client.describe_instances_health(
    EnvironmentName='string',
    EnvironmentId='string',
    AttributeNames=[
        'HealthStatus'|'Color'|'Causes'|'ApplicationMetrics'|'RefreshedAt'|'LaunchedAt'|'System'|'Deployment'|'AvailabilityZone'|'InstanceType'|'All',
    ],
    NextToken='string'
)
Parameters
  • EnvironmentName (string) -- Specify the AWS Elastic Beanstalk environment by name.
  • EnvironmentId (string) -- Specify the AWS Elastic Beanstalk environment by ID.
  • AttributeNames (list) --

    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.

    • (string) --
  • NextToken (string) -- Specify the pagination token returned by a previous call.
Return type

dict

Returns

Response Syntax

{
    'InstanceHealthList': [
        {
            'InstanceId': 'string',
            'HealthStatus': 'string',
            'Color': 'string',
            'Causes': [
                'string',
            ],
            'LaunchedAt': datetime(2015, 1, 1),
            '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
                }
            },
            'System': {
                'CPUUtilization': {
                    'User': 123.0,
                    'Nice': 123.0,
                    'System': 123.0,
                    'Idle': 123.0,
                    'IOWait': 123.0,
                    'IRQ': 123.0,
                    'SoftIRQ': 123.0,
                    'Privileged': 123.0
                },
                'LoadAverage': [
                    123.0,
                ]
            },
            'Deployment': {
                'VersionLabel': 'string',
                'DeploymentId': 123,
                'Status': 'string',
                'DeploymentTime': datetime(2015, 1, 1)
            },
            'AvailabilityZone': 'string',
            'InstanceType': 'string'
        },
    ],
    'RefreshedAt': datetime(2015, 1, 1),
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    Detailed health information about the Amazon EC2 instances in an AWS Elastic Beanstalk environment.

    • InstanceHealthList (list) --

      Detailed health information about each instance.

      The output differs slightly between Linux and Windows environments. There is a difference in the members that are supported under the <CPUUtilization> type.

      • (dict) --

        Detailed health information about an Amazon EC2 instance in your Elastic Beanstalk environment.

        • InstanceId (string) --

          The ID of the Amazon EC2 instance.

        • HealthStatus (string) --

          Returns the health status of the specified instance. For more information, see Health Colors and Statuses.

        • Color (string) --

          Represents the color indicator that gives you information about the health of the EC2 instance. For more information, see Health Colors and Statuses.

        • Causes (list) --

          Represents the causes, which provide more information about the current health status.

          • (string) --
        • LaunchedAt (datetime) --

          The time at which the EC2 instance was launched.

        • ApplicationMetrics (dict) --

          Request metrics from your application.

          • 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.

        • System (dict) --

          Operating system metrics from the instance.

          • CPUUtilization (dict) --

            CPU utilization metrics for the instance.

            • User (float) --

              Percentage of time that the CPU has spent in the User state over the last 10 seconds.

            • Nice (float) --

              Available on Linux environments only.

              Percentage of time that the CPU has spent in the Nice state over the last 10 seconds.

            • System (float) --

              Available on Linux environments only.

              Percentage of time that the CPU has spent in the System state over the last 10 seconds.

            • Idle (float) --

              Percentage of time that the CPU has spent in the Idle state over the last 10 seconds.

            • IOWait (float) --

              Available on Linux environments only.

              Percentage of time that the CPU has spent in the I/O Wait state over the last 10 seconds.

            • IRQ (float) --

              Available on Linux environments only.

              Percentage of time that the CPU has spent in the IRQ state over the last 10 seconds.

            • SoftIRQ (float) --

              Available on Linux environments only.

              Percentage of time that the CPU has spent in the SoftIRQ state over the last 10 seconds.

            • Privileged (float) --

              Available on Windows environments only.

              Percentage of time that the CPU has spent in the Privileged state over the last 10 seconds.

          • LoadAverage (list) --

            Load average in the last 1-minute, 5-minute, and 15-minute periods. For more information, see Operating System Metrics.

            • (float) --
        • Deployment (dict) --

          Information about the most recent deployment to an instance.

          • VersionLabel (string) --

            The version label of the application version in the deployment.

          • DeploymentId (integer) --

            The ID of the deployment. This number increases by one each time that you deploy source code or change instance configuration settings.

          • Status (string) --

            The status of the deployment:

            • In Progress : The deployment is in progress.
            • Deployed : The deployment succeeded.
            • Failed : The deployment failed.
          • DeploymentTime (datetime) --

            For in-progress deployments, the time that the deployment started.

            For completed deployments, the time that the deployment ended.

        • AvailabilityZone (string) --

          The availability zone in which the instance runs.

        • InstanceType (string) --

          The instance's type.

    • RefreshedAt (datetime) --

      The date and time that the health information was retrieved.

    • NextToken (string) --

      Pagination token for the next page of results, if available.

Exceptions

  • ElasticBeanstalk.Client.exceptions.InvalidRequestException
  • ElasticBeanstalk.Client.exceptions.ElasticBeanstalkServiceException

Examples

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

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

print(response)

Expected Output:

{
    'InstanceHealthList': [
        {
            'ApplicationMetrics': {
                'Duration': 10,
                'Latency': {
                    'P10': 0,
                    'P50': 0.001,
                    'P75': 0.002,
                    'P85': 0.003,
                    'P90': 0.004,
                    'P95': 0.005,
                    'P99': 0.006,
                    'P999': 0.006,
                },
                'RequestCount': 48,
                'StatusCodes': {
                    'Status2xx': 47,
                    'Status3xx': 0,
                    'Status4xx': 1,
                    'Status5xx': 0,
                },
            },
            'Causes': [
            ],
            'Color': 'Green',
            'HealthStatus': 'Ok',
            'InstanceId': 'i-08691cc7',
            'LaunchedAt': datetime(2015, 8, 13, 19, 17, 9, 3, 225, 0),
            'System': {
                'CPUUtilization': {
                    'IOWait': 0.2,
                    'IRQ': 0,
                    'Idle': 97.8,
                    'Nice': 0.1,
                    'SoftIRQ': 0.1,
                    'System': 0.3,
                    'User': 1.5,
                },
                'LoadAverage': [
                    0,
                    0.02,
                    0.05,
                ],
            },
        },
    ],
    'RefreshedAt': datetime(2015, 8, 20, 21, 9, 8, 3, 232, 0),
    'ResponseMetadata': {
        '...': '...',
    },
}