Collect metrics, logs, and traces using the CloudWatch agent
The CloudWatch agent is a software component that collects metrics, logs, and traces from your Amazon EC2 instances, on-premises servers, and containerized applications. It enables you to monitor your infrastructure and applications more comprehensively than the basic monitoring provided by default. The CloudWatch agent is built on the OpenTelemetry Collector, so it can receive OpenTelemetry data and send it to the CloudWatch OTLP endpoints.
The agent supports three configuration models:
-
Classic – The agent publishes metrics as CloudWatch metrics in a namespace,
CWAgentby default, which are billed as custom metrics. The Classic configuration also provides StatsD, collectd, procstat, JMX, NVIDIA GPU, EFA, NVMe, and network performance metrics, and CloudWatch Application Signals. For more information, see Configure the CloudWatch agent with the Classic configuration. -
Curated OpenTelemetry (recommended) – You configure the
opentelemetrysection of the agent JSON configuration file. The agent collects metrics, logs, and traces and sends them to the CloudWatch OpenTelemetry Protocol (OTLP) endpoints. Metrics use OpenTelemetry semantic conventions, keep their labels, and are queried with PromQL. They're billed per GB ingested. For more information, see Configure the CloudWatch agent with OpenTelemetry (recommended). -
Native OpenTelemetry (YAML) – You provide a standard OpenTelemetry Collector configuration in YAML, appended to the agent configuration file (the agent requires at least one JSON configuration file). This exposes the full OpenTelemetry Collector receiver set, including receivers that the
opentelemetrysection doesn't expose, such ascollectdandstatsd, and sends the data to the CloudWatch OTLP endpoints. For more information, see Appending OpenTelemetry collector configuration files.
In all three models, the agent collects logs from Amazon EC2 instances and on-premises servers
into Amazon CloudWatch Logs. The agent doesn't support collecting logs from FIFO pipes. For pricing, see
Amazon CloudWatch Pricing
To get started:
-
Choose a configuration model. For more information, see Choose a configuration model for the CloudWatch agent.
-
Complete the IAM and network prerequisites. For more information, see Prerequisites.
-
Install the agent. For more information, see Installing the CloudWatch agent.
-
Create the agent configuration file for the model that you chose, and start the agent.
The CloudWatch agent is open-source under the MIT license, and is hosted on GitHub