# Error when connecting Prometheus Datasource (local server) to Grafana cloud

**URL:** <https://community.grafana.com/t/error-when-connecting-prometheus-datasource-local-server-to-grafana-cloud/144124>\
**Category:** Configuration\
**Created:** [February 17, 2025, 4:57pm UTC](https://community.grafana.com/t/error-when-connecting-prometheus-datasource-local-server-to-grafana-cloud/144124 "2025-02-17T16:57:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joerozen](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@joerozen](https://community.grafana.com/u/joerozen)\
**Post date:** [February 17, 2025, 4:57pm UTC](https://community.grafana.com/t/error-when-connecting-prometheus-datasource-local-server-to-grafana-cloud/144124/1 "2025-02-17T16:57:03Z")

</div>

- What Grafana version and what operating system are you using? Grafana cloud

- **What** are you trying to achieve?  
Connect Local Prometheus Datasource to Grafana cloud.

- **How** are you trying to achieve it?  
I have install Prometheus on a ec2 server with a node\_exporter.

prometheus, version 3.1.0 (branch: HEAD, revision: 7086161a93b262aa0949dbf2aba15a5a7b13e0a3)  
build user: root@74c225e2044f  
build date: 20250102-13:52:43  
go version: go1.23.4  
platform: linux/amd64  
tags: netgo,builtinassets,stringlabels

node\_exporter, version 1.8.2 (branch: HEAD, revision: f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895)  
build user: root@03d440803209  
build date: 20240714-11:53:45  
go version: go1.22.5  
platform: linux/amd64  
tags: unknown

The Prometheus UI works and I have able to run querys.  
I have a Grafana cloud account and I tried to add Prometheus Data sources,  
Home \> Connections \> Data sources \> prometheus

- What happened?  
There was an error returned querying the Prometheus API.

- What did you **expect** to happen?  
success connections as I see when I run the same API in my browser:  
{“status”:“success”,“data”:{“resultType”:“scalar”,“result”:[4,“2”]}}

- Can you copy/paste the configuration(s) that you are having problems with?

- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.

`Get http://<DNS NAME>:9090/api/v1/query?query=1%2B1&time=4": dial tcp <MY IP>:9090: i/o timeout`- There was an error returned querying the Prometheus API.

- Did you follow any online instructions? If so, what is the URL?  
[Grafana Cloud](https://grafana.com/orgs/karkaot/hosted-metrics/506970#sending-metrics)

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [February 17, 2025, 5:10pm UTC](https://community.grafana.com/t/error-when-connecting-prometheus-datasource-local-server-to-grafana-cloud/144124/2 "2025-02-17T17:10:43Z")

</div>

Make sure that `http://<DNS NAME>:9090` is available from Grafana Cloud (public internet), not just from your browser. (It is an ec2 server, so EC2 must have a public IP, the correct security group, …). If you don’t want to create public-facing Prometheus, then [PDC](https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/) is a an option.

---

<div class="post-metadata">

**Author:** ![joerozen](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@joerozen](https://community.grafana.com/u/joerozen)\
**Post date:** [February 17, 2025, 5:43pm UTC](https://community.grafana.com/t/error-when-connecting-prometheus-datasource-local-server-to-grafana-cloud/144124/3 "2025-02-17T17:43:14Z")

</div>

That’s what I meant when I wrote ‘from my browser’  
I was able to connect my local Prometheus to grafana-cloud by using the Hosted Prometheus metrics on grafana-cloud:  
Home \> Connections \> Add new connection \> Hosted Prometheus metrics  
And adding remote\_write:

remote\_write:

- url: [https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push](https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push)  
basic\_auth:  
username:   
password: 

Now I need to figure out how I create convenient dashboards on grafana-cloud.

Thanks
