# APM using AWS EC2

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Faws%2Fapm-amazon-ec2.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Faws%2Fapm-amazon-ec2.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

Send EC2 metrics to Coralogix through [Amazon Data Firehose](https://coralogix.com/docs/integrations/aws/amazon-data-firehose/aws-cloudwatch-metric-streams-with-amazon-data-firehose.md) and stamp your logs and traces with the same EC2 identity, so a trace in Coralogix can show the CPU, disk, and network behavior of the exact instance that served it.

The correlation is what makes this worth doing: metrics alone tell you a host was busy, but a trace joined to that host tells you which request paid for it.

## What you need [​](#what-you-need- "Direct link to what-you-need-")

* A Coralogix account on the [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md) matching the region your data should be stored in. [Sign up](https://signup.coralogix.com/#/) if you do not have one.
* A Coralogix [Send-Your-Data API key](https://coralogix.com/docs/user-guides/account-management/api-keys/send-your-data-api-key.md).
* A metrics bucket configured under **Data Flow**, then **Setup Archive**.
* An active AWS account with the relevant permissions. See [creating an AWS account](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-creating.html).

## Send EC2 metrics [​](#send-ec2-metrics- "Direct link to send-ec2-metrics-")

[Configure Amazon Data Firehose](https://coralogix.com/docs/integrations/aws/amazon-data-firehose/aws-cloudwatch-metric-streams-with-amazon-data-firehose.md) to stream your EC2 metrics to Coralogix.

Send logs and traces as well as metrics. APM quality depends on all three being present, without logs and traces there is nothing to correlate the host metrics against.

## Tag telemetry with the EC2 host [​](#tag-telemetry-with-the-ec2-host- "Direct link to tag-telemetry-with-the-ec2-host-")

The resource detection processor reads the instance's identity and tags from the EC2 metadata service and attaches them to every signal the Collector emits.

1

<!-- -->

.

Add the resource detection processor

In your OpenTelemetry Collector configuration:

```
processors:

  resourcedetection/ec2:

    detectors: ["ec2", "env"]

    ec2:

      # Regular expressions matching the tag keys to add as resource attributes

      tags:

        - ^ec2.tag.name$

        - ^ec2.tag.subsystem$

        - ^aws.*$
```

2

<!-- -->

.

Add it to the traces pipeline

Append `resourcedetection/ec2` to the span processors:

```
traces:

  processors:

    - memory_limiter

    - batch

    - resourcedetection/ec2
```

3

<!-- -->

.

Add it to the logs pipeline

Do the same for logs:

```
logs:

  processors:

    - resourcedetection/ec2
```

The processor emits the attributes the correlation relies on:

| Attribute                             | Use                                                        |
| ------------------------------------- | ---------------------------------------------------------- |
| `cloud.provider` and `cloud.platform` | Confirm the process is running on AWS, on the EC2 platform |
| `host.id` and `host.name`             | Join logs and spans to the metrics of a specific instance  |

## View the correlated data [​](#view-the-correlated-data- "Direct link to view-the-correlated-data-")

1

<!-- -->

.

Open a trace

Select **Explore**, then **Tracing**, and select the trace you want to investigate.

[![Coralogix Tracing view listing traces by timestamp, action, service, duration, errors, and span count](/docs/assets/images/Trace-of-interest-1024x549-0d145e884336c0c06c616055b6ee2d7a.webp)](https://coralogix.com/docs/assets/images/Trace-of-interest-1024x549-0d145e884336c0c06c616055b6ee2d7a.webp)

Shows the trace list you pick from, filtered by application, subsystem, and service.

2

<!-- -->

.

Open the host panel

In the span detail pane, select the **HOST** tab to see the EC2 metrics carrying the same `host.id`.

[![Coralogix trace waterfall with the HOST tab open, showing CPU utilization and disk read and write charts for the instance](/docs/assets/images/APM-features-1-1024x573-826792c2268f5b291e4fe09cf07c7508.webp)](https://coralogix.com/docs/assets/images/APM-features-1-1024x573-826792c2268f5b291e4fe09cf07c7508.webp)

Shows a span alongside the host metrics of the EC2 instance that produced it.

## Related resources[​](#related-resources "Direct link to Related resources")

[CloudWatch metric streams with Amazon Data Firehose](https://coralogix.com/docs/integrations/aws/amazon-data-firehose/aws-cloudwatch-metric-streams-with-amazon-data-firehose.md)[Coralogix domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md)[Send-Your-Data API key](https://coralogix.com/docs/user-guides/account-management/api-keys/send-your-data-api-key.md)
