---
title: AWS X-Ray monitoring integration
source: https://docs.newrelic.com/docs/infrastructure/amazon-integrations/aws-integrations-list/aws-x-ray-monitoring-integration
---

New Relic offers an integration for reporting your AWS X-Ray data. This document explains how to activate this integration and describes the data that can be reported.

## Activate the integration [#activate-integration]

To enable the AWS X-Ray integration, follow standard procedures to [connect AWS services to infrastructure](https://docs.newrelic.com/docs/integrations/amazon-integrations/get-started/connect-aws-infrastructure).

When you've successfully connected your AWS account with New Relic:

1.  Go to **[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Infrastructure**, and then click **AWS**.
2.  Click **Manage Services** to select the AWS integration you want to activate.
3.  Check the checkbox next to **AWS X-Ray**.
4.  Click **Save**.

## Configuration and polling [#config-polling]

You can change the polling frequency and filter your data using [configuration options](https://docs.newrelic.com/docs/integrations/new-relic-integrations/cloud-integrations/configure-polling-frequency-data-collection-cloud-integrations).

Here's the default [polling](https://docs.newrelic.com/docs/integrations/amazon-integrations/get-started/polling-intervals-aws-integrations) information for the AWS X-Ray integration:

-   New Relic polling interval: 5 minutes

> #### 💡 TIP
>
> Please allow up to 20 minutes for your first traces to appear. Since traces are collected after they complete, and only once per polling interval, the X-Ray trace data lags real-time considerably, and should not be used for alerting.

> #### ⚠️ IMPORTANT
>
> Polling intervals longer than 5 minutes may result in lost traces. New Relic drops trace data more than 20 minutes old. Similarly, long-running traces are likely to be incomplete. X-Ray monitoring collects completed traces only, and spans within a trace older than 20 minutes are dropped.

## Find and use data [#find-data]

New Relic reports X-Ray segments as [`Span` data](https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/#new-relic-tracing). Once you've activated this integration, you should see AWS X-Ray traces appearing in [distributed tracing](https://docs.newrelic.com/docs/apm/distributed-tracing/ui-data/understand-use-distributed-tracing-data).

To filter your spans, you can use the `newRelic.ingestPoint` attribute. This attribute is set to `xray.polling` for all X-Ray spans.

Here's an example NRQL query to verify X-Ray ingest:

```sql
SELECT count(*) FROM Span WHERE newRelic.ingestPoint = 'xray.polling' TIMESERIES
```

Here's an example NRQL query to correlate X-Ray data with specific API performance:

```sql
SELECT average(duration.ms) FROM Span WHERE newRelic.ingestPoint = 'xray.polling' 
AND http.url LIKE 'https://yourdomanin.com/api/v1/endpoint%' SINCE 1 month ago 
LIMIT MAX TIMESERIES 1 day
```

## Using custom IAM policies [#use-iam]

If you're using a custom IAM policy when connecting your AWS account with the infrastructure agent, your custom policy will need the following permissions for the AWS X-Ray integration to work:

-   `xray:BatchGet*`
-   `xray:Get*`

## X-Ray and Lambda Functions [#lambda]

Lambda functions require some configuration to use X-Ray. See the
[Using AWS X-Ray](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html) section in the AWS Lambda Developer
Guide.

In particular, note that the execution role for your Lambda function will need
[additional permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to
record data to X-Ray.

## X-Ray and Step Functions [#x-ray-step]

AWS Step Function state machines are distributed applications, and can be monitored with X-Ray. X-Ray tracing needs to
be [explicitly enabled](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-xray-tracing.html) for X-Ray to
capture data for step function state machines.

Be sure to enable X-Ray tracing for any [lambda functions](#lambda) in your state machine as well as for the
state machine overall.
