Configure Prometheus remote write to send metrics to Grafana Cloud
To configure Prometheus to remote write to Grafana Cloud, complete the following steps:
- Log into your Cloud Portal and select your stack. ![Image of stack selected in the Grafana Cloud Portal]() 
- Click the name of your stack under Grafana Cloud located on the left navigation panel. 
- On the Prometheus tile, click Send Metrics. 
- Scroll down the page until you locate the Sending metrics with Prometheus section. - This section contains a snippet of code that you’ll add to your Prometheus deployment. 
- Just below the code sample, click Generate now to generate an API token. - The API token ensures a secure connection to Grafana Cloud. ![Picture of Generate now link to create API token]() 
- On the Create an API token screen, enter a name for the token and click Create token. - The code snippet populates with the token you just created. 
- On the Create an API token screen, click Close. 
- Just below the code snippet, click Copy to clipboard. - In the following steps, you’ll add the code snippet to the - prometheus.ymlfile.
- Log into the machine on which Prometheus is installed. 
- Open a terminal and if required, switch to a user with write privileges. - For example: - sudo su -
- Open the - prometheus.ymlfile located under- /etc/prometheus.- For example, if you are using Vim, run: - vim /etc/prometheus/prometheus.yml
- Edit the YAML file. - When using Vi or Vim as the text editor, press - ito edit the YAML file.- The button you use to the edit the YAML file depends on the text editor you are using. 
- Scroll to the end of the file and paste the snippet of code you copied from the Grafana Cloud Portal. 
- Exit edit mode and save your changes. - For example, when using Vi or Vim, press the - Esckey to exit insert mode type- :wqto save your changes and exit.
- Restart the Prometheus service to apply the changes. - For example: run the command - systemctl restart prometheus.yml- After restarting the Prometheus service, metrics should be forwarded to Grafana Cloud. 
- To check the Prometheus service status, run the following command: - systemctl status prometheus.service- If there are errors, refer to the relevant logs in - /var/log/syslogor- journalctl.
In the next stop in your journey, you’ll verify that Prometheus is sending metrics to Grafana Cloud.
Troubleshooting options
Please tell us what didn't work:
At this point in your journey, you can explore the following paths:
Send data from multiple Prometheus instances
Send data from multiple high-availability Prometheus instances






