> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# astro env metrics-export create

<Info>
  This command is only available on Astro.
</Info>

Create a metrics export that pushes Deployment metrics to a remote endpoint, such as a Prometheus remote-write target. You can scope the metrics export to a Workspace or a Deployment.

## Usage

```bash wrap theme={null}
astro env metrics-export create
```

## Options

| Option               | Description                                                                                                                                                         | Possible Values                   |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| `-k`,`--key`         | The metrics export key. Required.                                                                                                                                   | Any string                        |
| `--endpoint`         | The remote endpoint to push metrics to.                                                                                                                             | Any valid URL                     |
| `--exporter-type`    | The exporter type, for example `PROMETHEUS`.                                                                                                                        | Any valid exporter type           |
| `--auth-type`        | The authentication type for the endpoint.                                                                                                                           | `BASIC`, `AUTH_TOKEN`, or `SIGV4` |
| `--username`         | The username for `BASIC` authentication.                                                                                                                            | Any string                        |
| `--password`         | The password for `BASIC` authentication. If omitted alongside `--auth-type BASIC`, the CLI reads it from stdin when piped, or prompts for it with the input hidden. | Any string                        |
| `--basic-token`      | The bearer or authentication token for `AUTH_TOKEN` authentication.                                                                                                 | Any string                        |
| `--sigv4-assume-arn` | The AWS IAM role to assume for `SIGV4` authentication.                                                                                                              | Any valid IAM role ARN            |
| `--sigv4-sts-region` | The AWS STS region for `SIGV4` authentication.                                                                                                                      | Any valid AWS region              |
| `--header`           | A request header in `KEY=VALUE` form. Repeatable.                                                                                                                   | `KEY=VALUE`                       |
| `--label`            | A metric label in `KEY=VALUE` form. Repeatable.                                                                                                                     | `KEY=VALUE`                       |
| `--auto-link`        | Workspace scope only. Automatically link the metrics export to all Deployments in the Workspace, including future ones.                                             | None                              |
| `--workspace-id`     | Set the Workspace scope. Mutually exclusive with `--deployment-id`. Defaults to your current Workspace from CLI context.                                            | Any valid Workspace ID            |
| `--deployment-id`    | Set the Deployment scope. Mutually exclusive with `--workspace-id`.                                                                                                 | Any valid Deployment ID           |

## Examples

```bash wrap theme={null}
# Create a Prometheus metrics export with basic authentication
astro env metrics-export create --workspace-id <workspace-id> \
  --key prom_main \
  --endpoint https://prom.example.com/api/v1/write \
  --exporter-type PROMETHEUS \
  --auth-type BASIC --username scraper --password "$SCRAPER_PASSWORD"
```

## Related commands

* [`astro env metrics-export update`](/docs/cli/v1.43/astro-env-metrics-export-update)
* [`astro env metrics-export list`](/docs/cli/v1.43/astro-env-metrics-export-list)
* [`astro env metrics-export delete`](/docs/cli/v1.43/astro-env-metrics-export-delete)
