Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana/latest/as-code/observability-as-code/grafana-cli/gcx/guides/manage-resources.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana/latest/as-code/observability-as-code/grafana-cli/gcx/guides/manage-resources/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/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. In this example scenario, use dev for the development environment and prod for production.
- Make changes to dashboards and other resources using the Grafana UI in your development instance.
- Pull those resources from the development environment to your local machine:shell
gcx resources pull --context dev # Add `-o yaml` export resources as YAML - Push the resources to production:shell
gcx resources push --context prod
Note
Resources are pulled and pushed from the
./resourcesdirectory by default. Configure this path with the--path/-pflags.
./resources directory by default.
Configure this path with the --path/-p flags.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.
- Ensure the current context points to the Grafana instance to backup/restore:shell
gcx config use-context YOUR_CONTEXT # for example "prod" - Pull all resources from your target environment:shell
gcx resources pull --path ./backup-prod # Add `-o yaml` to export resources as YAML - Save the exported resources to version control or cloud storage.
- Push the resources to restore them:shell
gcx resources push --path ./backup-prod
Was this page helpful?
Related resources from Grafana Labs


