AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Monitoring Application Health

When you are running a production website, it is important to know that your application is available and responding to requests. To assist with monitoring your application’s responsiveness, AWS Elastic Beanstalk provides features that monitor statistics about your application and create alerts that trigger when thresholds are exceeded.

Health Monitoring

To check application health status, every minute or two Elastic Load Balancing sends a request to the application health check URL. By default, Elastic Load Balancing uses TCP:80 for nonlegacy configurations and HTTP:80 for legacy configurations. (If you are unsure if you are running a legacy configuration, check the Elastic Beanstalk console. For instructions, see To check if you are using a legacy container type.) You can choose to override this setting by specifying an existing resource in your application. If you specify a path like /myapp/index.jsp, the health check URL is set to http:80//myapp/index.jsp. (The exact port number depends on your environment's configuration.) However, you can also specify a different protocol and port, such as UDP:8888. For instructions on modifying your health check URL using the AWS Management Console, see Health Checks.

Elastic Load Balancing expects a response of 200 OK for the application to be considered healthy. The application fails the application health check if it responds with any other HTTP status code. When a health check fails, Elastic Load Balancing marks the state of the instance as out of service. For more information about health checks performed by Elastic Load Balancing, see Health Check in the Elastic Load Balancing Developer Guide.

Important

For single-instance environments, health checks are done by Amazon EC2 instance status monitoring, so the health check URL doesn't apply. Amazon EC2 performs automated checks on the instance to identify hardware and software issues. For more information, see Monitoring Instances with Status Checks in the Amazon Elastic Compute Cloud User Guide for Linux.

AWS Elastic Beanstalk will change the health status of a web server environment tier to one of four color values depending on how the application responds to the health check. The following table describes the color codes.

ColorStatus

Green

Your application responded to the application health check URL within the last minute.

Yellow

Your application hasn't responded to the application health check URL within the last five minutes.

Red

One of the following:

  • Your application hasn't responded to the application health check URL for more than five minutes.

  • An environment is also considered red if AWS Elastic Beanstalk detects other problems with the environment that are known to make the application unavailable (e.g., the load balancer was deleted).

Gray

Your application's health status is unknown because status is reported when the application is not in the ready state.

For a web server environment tier, whenever the application health check URL fails to return a 200 OK response, AWS Elastic Beanstalk performs a series of additional checks to try to determine the cause of the failure. These additional checks include verifying the following:

  • The load balancer still exists.

  • The Auto Scaling group still exists.

  • At least one Amazon EC2 instance behind the load balancer is returning an InService response.

  • The Amazon EC2 security group is configured to allow ingress on port 80.

  • The environment CNAME exists and is pointing to the right load balancer.

  • All Amazon EC2 instances are communicating.

In addition to environment-level health checking, AWS Elastic Beanstalk also communicates with every Amazon EC2 instance running as part of your Elastic Beanstalk application. If any Amazon EC2 instance fails to respond to ten consecutive health checks, Elastic Beanstalk will terminate the instance, and Auto Scaling will start a new instance.

If the status of your application health changes to red, you can take several corrective actions:

  • Look at environment events. You might find more information about the problem here.

  • If you recently deployed a new version of the application, try rolling back to an older version that is known to work.

  • If you recently made configuration changes, try reverting to the former settings.

  • If the problem appears to be with the environment, try rebuilding the environment. In the AWS Toolkit for Visual Studio, on the AWS Explorer tab, right-click your application environment, and then click Rebuild Environment.

  • Try using Snapshot logs to view recent log file entries or log in to the Amazon EC2 instance and troubleshoot directly.

The health of a worker environment tier is gauged similarly to that of a web server environment tier. The health status color codes are also similar. AWS Elastic Beanstalk will change the health status of a worker environment tier to one of four color values depending on how the application responds to the health check. The following table describes the color codes.

ColorStatus

Green

Within the last three minutes:

  • At least one daemon (on any instance) successfully polled the SQS queue for messages within the last three minutes.

  • If the worker environment tier is configured with an application health check URL, the daemon received a 200 OK response to an HTTP GET request it sent to the URL.

  • If the worker environment tier is not configured with an application health check URL, it successfully established a TCP connection to the TCP port on the local host.

Yellow

There haven't been any healthy instances in the environment for up to three minutes.

Red

One of the following:

  • Auto Scaling is configured with a minimum size of zero instances.

  • The autoscaling group has not had any healthy instances for at least three minutes.

Gray

Your application's health status is unknown because the environment health hasn't been reported to CloudWatch.

AWS Elastic Beanstalk publishes its worker environment tier health status to CloudWatch, where a status of 1 is Green. In order to publish metrics, you must grant the appropriate permissions on the IAM role. For more information, go to Granting IAM Role Permissions for Worker Environment Tiers. You can review the CloudWatch health metric data in your account via the ElasticBeanstalk/SQSD namespace. The metric dimension is EnvironmentName, and the metric name is Health. All instances publish their metrics to the same namespace.

Monitoring Your Environment

You can access operational information about your application from the AWS Management Console at http://console.aws.amazon.com/elasticbeanstalk.

The AWS Management Console displays your environment's status and application health at a glance. In the AWS Elastic Beanstalk console applications page, each environment is color-coded to indicate an environment's status.

To view metrics for an environment

  1. From the AWS Elastic Beanstalk console applications page, click an environment name to view the environment dashboard.

  2. In the left navigation, click Monitoring.

    The Monitoring page shows you overall statistics about your environment, such as CPU utilization and average latency. In addition to the overall statistics, you can view monitoring graphs that show resource usage over time. You can click any of the graphs to view more detailed information.

    Note

    By default, only basic CloudWatch metrics are enabled, which return data in five-minute periods. You can enable more granular one-minute CloudWatch metrics by editing your environment's configuration settings.

To add a metric to the Monitoring page

  1. In the Monitoring section of the Monitoring page, click Edit.

  2. In the Add Graph section, select the resource, metric, statistic, and dimension that you want to add.

    For more information about metrics and dimensions for each resource, see Amazon CloudWatch Metrics, Namespaces, and Dimensions Reference in the Amazon CloudWatch Developer Guide.

  3. After you select the details of the graph, click Add.

  4. If you want to add another graph, select details for the new graph and then click Add Another.

  5. After you completed adding the graphs that you want, click Save.

    The graphs are added to the Monitoring page.