---
title: "Update usage groups for a customer with an existing configuration | Grafana Cloud documentation"
description: "How to update usage groups for a customer stack that already has usage groups configured."
---

# Update an existing usage groups configuration

> Caution
> 
> Self-service configuration for this feature is not available yet. If you would like to update your usage groups configuration, contact Grafana Labs Support.

This section describes how to update an already existing `MimirUsageGroupsConfiguration` resource named `config` for a customer stack. This includes adding new usage groups, modifying existing ones, or removing them.

## 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: Pull the existing configuration

Fetch the existing `MimirUsageGroupsConfiguration` resource:

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

```bash
gcx resources pull mimirusagegroupsconfiguration/config --path <path-to-local-copy> -o yaml
```

This command stores the resource locally at:

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

```none
  <path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yaml
```

Expected result:

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

```none
  ✔ 1 resources pulled
```

### Step 3: Create a backup

Before making any changes, create a backup of the fetched configuration files. For example, in a separate folder on path:

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

```none
<path-to-local-copy-backup>
```

This ensures you can restore the previous configuration if needed.

### Step 4: Modify the configuration

Edit the file:

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

```none
<path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yaml
```

Update the spec.usageGroups section as required:

- Add new usage groups
- Modify existing usage groups
- Delete usage groups that are no longer needed

Ensure that all changes follow the required syntax and naming constraints. For example, the updated configuration can look like this:

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/dev: '{env=~"dev.*"}' # this is a new usage group
    grafanacloud_usage_group/production: '{env=~"prod.*|ops.*"}' # this is a modification of an existing usage group
```

### Step 5: Push the updated configuration

Apply the updated configuration:

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

```bash
  gcx resources push mimirusagegroupsconfiguration/config --path <path-to-local-copy>/mimirusagegroupsconfigurations.v1alpha1.mimir.ext.grafana.com/config.yaml
```

If update is successful, 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 the `MimirUsageGroupsConfiguration` resource named `config` has been updated. It is then automatically validated and propagated to the customer’s Mimir environment. 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).
