How Amazon CloudWatch Application Insights works - Amazon CloudWatch
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

How Amazon CloudWatch Application Insights works

This section contains information about how CloudWatch Application Insights works, including:

How Application Insights monitors applications

Application Insights monitors applications as follows.

Application discovery and configuration

The first time an application is added to CloudWatch Application Insights it scans the application components to recommend key metrics, logs, and other data sources to monitor for your application. You can then configure your application based on these recommendations.

Data preprocessing

CloudWatch Application Insights continuously analyzes the data sources being monitored across the application resources to discover metric anomalies and log errors (observations).

Intelligent problem detection

The CloudWatch Application Insights engine detects problems in your application by correlating observations using classification algorithms and built-in rules. To assist in troubleshooting, it creates automated CloudWatch dashboards, which include contextual information about the problems.

Alert and action

When CloudWatch Application Insights detects a problem with your application, it generates CloudWatch Events to notify you of the problem. See Application Insights CloudWatch Events and notifications for detected problems for more information about how to set up these Events.

Example scenario

You have an ASP .NET application that is backed by a SQL Server database. Suddenly, your database begins to malfunction because of high memory pressure. This leads to application performance degradation and possibly HTTP 500 errors in your web servers and load balancer.

With CloudWatch Application Insights and its intelligent analytics, you can identify the application layer that is causing the problem by checking the dynamically created dashboard that shows the related metrics and log file snippets. In this case, the problem might be at the SQL database layer.

Data retention

CloudWatch Application Insights retains problems for 55 days and observations for 60 days.


For default quotas for CloudWatch Application Insights, see Amazon CloudWatch Application Insights endpoints and quotas. Unless otherwise noted, each quota is per Amazon Region. Contact Amazon Support to request an increase in your service quota. Many services contain quotas that cannot be changed. For more information about the quotas for a specific service, see the documentation for that service.

Amazon Systems Manager (SSM) packages used by CloudWatch Application Insights

The packages listed in this section are used by Application Insights, and can be independently managed and deployed with Amazon Systems Manager Distributor. For more information about SSM Distributor, see Amazon Systems Manager Distributor in the Amazon Systems Manager User Guide.


You can retrieve workload-specific Java metrics from Prometheus JMX exporter for Application Insights to configure and monitor alarms. In the Application Insights console, on the Manage monitoring page, select JAVA application from the Application tier dropdown. Then under JAVA Prometheus exporter configuration, select your Collection method and JMX port number.

To use Amazon Systems Manager Distributor to package, install, and configure the Amazon-provided Prometheus JMX exporter package independently of Application Insights, complete the following steps.

Prerequisites for using the Prometheus JMX exporter SSM package

  • SSM agent version 2.3.1550.0 or later installed

  • The JAVA_HOME environment variable is set

Install and configure the AWSObservabilityExporter-JMXExporterInstallAndConfigure package

The AWSObservabilityExporter-JMXExporterInstallAndConfigure package is an SSM Distributor package that you can use to install and configure Prometheus JMX Exporter. When Java metrics are sent by the Prometheus JMX exporter, the CloudWatch agent can be configured to retrieve the metrics for the CloudWatch service.

  1. Based on your preferences, prepare the Prometheus JMX exporter YAML configuration file located in the Prometheus GitHub repository using the example configuration and option descriptions to guide you.

  2. Copy the Prometheus JMX exporter YAML configuration file encoded as Base64 to a new SSM parameter in SSM Parameter Store.

  3. Navigate to the SSM Distributor console and open the Third party tab. Select AWSObservabilityExporter-JMXExporterInstallAndConfigure and choose Install one time.

  4. Update the SSM parameter you created in the first step by replacing "Additional Arguments" with the following:


    Port 9404 is the default port used to send Prometheus JMX metrics; however, you can update it.

Example: Configure CloudWatch agent to retrieve Java metrics

  1. Install the Prometheus JMX exporter as described in the previous procedure and verify that it is correctly installed on your instance by checking the port status.

    Successful installation on Windows instance example

    PS C:\> curl http://localhost:9404 (http://localhost:9404/) StatusCode : 200 StatusDescription : OK Content : # HELP jvm_info JVM version info

    Successful installation on Linux instance example

    $ curl localhost:9404 # HELP jmx_config_reload_failure_total Number of times configuration have failed to be reloaded. # TYPE jmx_config_reload_failure_total counter jmx_config_reload_failure_total 0.0
  2. Create the Prometheus service discovery YAML file. The following example service discovery file performs the following:

    • Specifies the Prometheus JMX exporter host port as localhost: 9404.

    • Attaches labels (Application, ComponentName, and InstanceId) to the metrics, which can be set as CloudWatch metric dimensions.

    $ cat prometheus_sd_jmx.yaml - targets: - labels: Application: myApp ComponentName: arn-cn:aws:elasticloadbalancing:cn-north-1:123456789012:loadbalancer/app/sampl-Appli-MMZW8E3GH4H2/aac36d7fea2a6e5b InstanceId: i-12345678901234567
  3. Create the Prometheus JMX exporter configuration YAML file. The following example configuration file specifies the following:

    • The metrics retrieval job interval and timeout period.

    • The metrics retrieval (also know as "scraping") jobs (jmx and sap), which include the job name, maximum time series returned at a time, and service discovery file path.

    $ cat prometheus.yaml global: scrape_interval: 1m scrape_timeout: 10s scrape_configs: - job_name: jmx sample_limit: 10000 file_sd_configs: - files: ["/tmp/prometheus_sd_jmx.yaml"] - job_name: sap sample_limit: 10000 file_sd_configs: - files: ["/tmp/prometheus_sd_sap.yaml"]
  4. Verify that the CloudWatch agent is installed on your Amazon EC2 instance and that the version is 1.247346.1b249759 or later. To install the CloudWatch agent on your EC2 instance, see Installing the CloudWatch Agent. To verify the version, see Finding information about CloudWatch agent versions.

  5. Configure the CloudWatch agent. For more information about how to configure the CloudWatch agent configuration file, see Manually create or edit the CloudWatch agent configuration file. The following example CloudWatch agent configuration file performs the following:

    • Specifies the Prometheus JMX exporter configuration file path.

    • Specifies the target log group to which to publish EMF metric logs.

    • Specifies two sets of dimensions for each metric name.

    • Sends 8 (4 metric names * 2 sets of dimensions per metric name) CloudWatch metrics.

    { "logs":{ "logs_collected":{ .... }, "metrics_collected":{ "prometheus":{ "cluster_name":"prometheus-test-cluster", "log_group_name":"prometheus-test", "prometheus_config_path":"/tmp/prometheus.yaml", "emf_processor":{ "metric_declaration_dedup":true, "metric_namespace":"CWAgent", "metric_unit":{ "jvm_threads_current":"Count", "jvm_gc_collection_seconds_sum":"Second", "jvm_memory_bytes_used":"Bytes" }, "metric_declaration":[ { "source_labels":[ "job" ], "label_matcher":"^jmx$", "dimensions":[ [ "InstanceId", "ComponentName" ], [ "ComponentName" ] ], "metric_selectors":[ "^java_lang_threading_threadcount$", "^java_lang_memory_heapmemoryusage_used$", "^java_lang_memory_heapmemoryusage_committed$" ] } ] } } } }, "metrics":{ .... } }