---
title: "Create usage groups for a customer without existing configuration | Grafana Cloud documentation"
description: "How to create usage groups for a customer stack that does not currently have any usage groups configured."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Create usage groups for a customer without existing configuration

This section describes how to create usage groups for a customer stack that does not currently have any usage groups configured.

## Before you begin

> Note
> 
> Ensure you have completed the [prerequisites](/docs/grafana-cloud/cost-management-and-billing/analyze-costs/metrics-costs/usage-groups/configure-usage-groups/#before-you-begin).

## Step 1: Select the customer context

Use `gcx CLI` to switch to the desired context:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
gcx config use-context <CONTEXT>
```

For more details on how to correctly configure contexts, refer to the [gcx CLI Configuration](https://github.com/grafana/gcx/blob/main/docs/configuration.md).

## Step 2: Check whether usage groups have already been configured

> Note
> 
> A namespace can contain only one `MimirUsageGroupsConfiguration` resource. Any attempt to create another in the same namespace fails.

To verify if usage groups are already configured in your stack, run:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
  gcx resources get mimirusagegroupsconfigurations
```

- If no output is returned, you can proceed to [Step 3](/docs/grafana-cloud/cost-management-and-billing/analyze-costs/metrics-costs/usage-groups/configure-usage-groups/create-new/#step-3-create-the-configuration-file)
- If you see output similar to the following, usage groups have already been configured. To modify an existing configuration, refer to [Update an existing configuration](/docs/grafana-cloud/cost-management-and-billing/analyze-costs/metrics-costs/usage-groups/configure-usage-groups/update-existing/).

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
  KIND                            GROUP                   NAME
  MimirUsageGroupsConfiguration   mimir.ext.grafana.com   config
```

## Step 3: Create the configuration file

Define a `MimirUsageGroupsConfiguration` resource in a YAML (or JSON) file named `config.yaml`.

For example:

YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```yaml
apiVersion: mimir.ext.grafana.com/v1alpha1
kind: MimirUsageGroupsConfiguration
metadata:
  name: config
spec:
  usageGroups:
    grafanacloud_usage_group/errors: '{status=~"5.."}'
    grafanacloud_usage_group/production: '{env=~"prod.*"}'
```

Save this file locally, for example at:

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
  /path/to/usage-groups/config.yaml
```

## Step 4: Push the configuration

Apply the configuration using the following command:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
  gcx resources push --path ./path/to/usage-groups/config.yaml
```

If the configuration is valid and successfully applied, the following message is displayed:

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
  ✔ 1 resources pushed, 0 errors
```

This indicates that a `MimirUsageGroupsConfiguration` resource named `config` has been created in the namespace associated with the customer’s stack. For more details on how to manage resources using `gcx CLI`, refer to [Manage resources with Grafana CLI](https://github.com/grafana/gcx/blob/main/docs/guides/manage-resources.md).
