| title | Manage resources |
|---|
Grafana resources can be migrated from one environment to another, for example: from a development to production environment.
As such, you will need to configure several contexts: one per environment.
In this example scenario, we will 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:
gcx resources pull --context dev # Add `-o yaml` export resources as YAML -
Push the resources to production:
gcx resources push --context prod
!!! note
Resources are pulled and pushed from the ./resources directory by default.
This path can be configured with the --path/-p flags.
This workflow helps you 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:
gcx config use-context YOUR_CONTEXT # for example "prod" -
Pull all resources from your target environment:
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:
gcx resources push --path ./backup-prod