---
title: Preview AWS metric name filter
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > AWS Integration
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Preview AWS metric name filter{% #preview-aws-metric-name-filter %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                                                                          |
| ----------------- | --------------------------------------------------------------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/integration/aws/accounts/{aws_account_config_id}/metric_name_filter_preview |

### Overview

Preview which collected CloudWatch metrics would be filtered by the supplied metric name filters. The filters are not persisted. This endpoint requires the `aws_configuration_read` permission.

### Arguments

#### Path Parameters

| Name                                    | Type   | Description                                                                                                                                                                                                                                                 |
| --------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| aws_account_config_id [*required*] | string | Unique Datadog ID of the AWS Account Integration Config. To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration.md#list-all-aws-integrations) endpoint and query by AWS Account ID. |

### Request

#### Body Data (required)

The metric name filters to preview.

{% tab title="Model" %}

| Parent field        | Field                                 | Type            | Description                                                                                            |
| ------------------- | ------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------ |
|                     | data [*required*]                | object          | AWS metric name filter preview request data.                                                           |
| data                | attributes [*required*]          | object          | AWS metric name filter preview request attributes.                                                     |
| attributes          | metric_name_filters [*required*] | [ <oneOf>] | The metric name filters to preview.                                                                    |
| metric_name_filters | Object 1                              | object          | Include only metric names matching one of these patterns for a single namespace.                       |
| Object 1            | include_only [*required*]        | [string]        | Include only metric names matching one of these patterns.                                              |
| Object 1            | namespace [*required*]           | string          | The AWS CloudWatch namespace to which this metric name filter applies.                                 |
| metric_name_filters | Object 2                              | object          | Exclude metric names matching one of these patterns for a single namespace.                            |
| Object 2            | exclude_only [*required*]        | [string]        | Exclude metric names matching one of these patterns.                                                   |
| Object 2            | namespace [*required*]           | string          | The AWS CloudWatch namespace to which this metric name filter applies.                                 |
| data                | type [*required*]                | enum            | The `AWSMetricNameFilterPreviewResponseData` `type`. Allowed enum values: `metric_name_filter_preview` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "metric_name_filters": [
        {
          "include_only": [
            "aws.ec2.network_in"
          ],
          "namespace": "AWS/EC2"
        }
      ]
    },
    "type": "metric_name_filter_preview"
  }
}
```

{% /tab %}

### Response

{% tab title="200" %}
AWS metric name filter preview result
{% tab title="Model" %}
AWS metric name filter preview response body.

| Parent field | Field                         | Type     | Description                                                                                                                                                                                                                                                 |
| ------------ | ----------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]        | object   | AWS metric name filter preview response data.                                                                                                                                                                                                               |
| data         | attributes [*required*]  | object   | AWS metric name filter preview response attributes.                                                                                                                                                                                                         |
| attributes   | namespaces [*required*]  | [object] | The list of namespaces affected by the previewed metric name filters.                                                                                                                                                                                       |
| namespaces   | filters [*required*]     | [object] | The metric name filter patterns evaluated for this namespace and how many metrics they matched.                                                                                                                                                             |
| filters      | match_count [*required*] | int64    | The number of Datadog metric names matched by this pattern.                                                                                                                                                                                                 |
| filters      | pattern [*required*]     | string   | The metric name filter pattern.                                                                                                                                                                                                                             |
| namespaces   | metrics [*required*]     | [object] | The CloudWatch metrics collected for this namespace and whether each resulting Datadog metric is filtered.                                                                                                                                                  |
| metrics      | cw_name [*required*]     | string   | The CloudWatch metric name.                                                                                                                                                                                                                                 |
| metrics      | dd_names [*required*]    | [object] | The Datadog metric names produced from this CloudWatch metric.                                                                                                                                                                                              |
| dd_names     | filtered [*required*]    | boolean  | Whether this Datadog metric name is filtered out.                                                                                                                                                                                                           |
| dd_names     | name [*required*]        | string   | The Datadog metric name.                                                                                                                                                                                                                                    |
| namespaces   | namespace [*required*]   | string   | The AWS CloudWatch namespace.                                                                                                                                                                                                                               |
| data         | id [*required*]          | string   | Unique Datadog ID of the AWS Account Integration Config. To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration.md#list-all-aws-integrations) endpoint and query by AWS Account ID. |
| data         | type [*required*]        | enum     | The `AWSMetricNameFilterPreviewResponseData` `type`. Allowed enum values: `metric_name_filter_preview`                                                                                                                                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "namespaces": [
        {
          "filters": [
            {
              "match_count": 1,
              "pattern": "aws.ec2.network_in"
            }
          ],
          "metrics": [
            {
              "cw_name": "NetworkIn",
              "dd_names": [
                {
                  "filtered": true,
                  "name": "aws.ec2.network_in"
                }
              ]
            }
          ],
          "namespace": "AWS/EC2"
        }
      ]
    },
    "id": "00000000-abcd-0001-0000-000000000000",
    "type": "metric_name_filter_preview"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Path parameters export aws_account_config_id="CHANGE_ME" \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/integration/aws/accounts/${aws_account_config_id}/metric_name_filter_preview" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "metric_name_filters": [
        {
          "exclude_only": [
            "aws.ec2.network_in"
          ],
          "namespace": "AWS/EC2"
        }
      ]
    },
    "type": "metric_name_filter_preview"
  }
}
EOF 
                
{% /tab %}
