---
title: "Manage resources | Grafana documentation"
description: "Use gcx to manage resources."
---

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

# Manage resources with `gcx`

## Migrate resources between environments

Grafana resources can be migrated from one environment to another, for example from a development to production environment.

You need to [configure one context per environment](https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/configuration#define-contexts-to-use-different-instances). In this example scenario, use `dev` for the development environment and `prod` for production.

1. Make changes to dashboards and other resources using the Grafana UI in your **development instance**.
2. Pull those resources from the development environment to your local machine:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx resources pull --context dev # Add `-o yaml` export resources as YAML 
   ```
3. Push the resources to production:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx resources push --context prod
   ```

> Note
> 
> Resources are pulled and pushed from the `./resources` directory by default. Configure this path with the `--path`/`-p` flags.

## Name pulled files by title

By default, `gcx resources pull` names each file using the resource’s `metadata.name` (usually its UID). Use `--filename-by=title` for readable filenames:

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

```shell
gcx resources pull dashboards --filename-by=title --path ./dashboard-backup
```

For example, a dashboard titled `Ventas Overview` becomes `ventas-overview.json` inside its usual resource-type directory. Resources without a usable title fall back to `metadata.name`. The resource contents retain their original identity, so push, validate, and serve use these files normally.

Title mode resolves filename conflicts, preserving files that belong to other resources. See the [file naming rules](https://github.com/grafana/gcx/blob/main/docs/design/naming.md#92-file-naming) for the full algorithm.

`PULL` doesn’t remove old files. Title-mode pull warns on stderr when it finds another file for the same resource at a different path, such as after a rename or switching naming modes. Reading resources also warns when skipping duplicate identities. Pull into a clean directory or remove stale files (for example, with `git rm`) before pushing.

## Back up and restore resources

Follow this workflow to back up all Grafana resources from one instance and later restore them. This can be useful to replicate a configuration or perform disaster recovery.

1. Ensure the current context points to the Grafana instance to backup/restore:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx config use-context YOUR_CONTEXT  # for example "prod"
   ```
2. Pull all resources from your target environment:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx resources pull --path ./backup-prod # Add `-o yaml` to export resources as YAML
   ```
3. Save the exported resources to version control or cloud storage.
4. Push the resources to restore them:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx resources push --path ./backup-prod
   ```

## Incident descriptions

Incident descriptions remain visible in `GET` and `LIST` results.

`PULL` omits descriptions from saved manifests. You cannot restore descriptions if you backed up an incident with `gcx resources pull`.

Old backup files can contain `spec.description`. Remove that field before you push the file to create an incident or to change an incident with a different description. You can still update other fields.
