# Using Google Cloud SQL Auth Proxy through Streamlit Cloud

**URL:** <https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793>\
**Category:** Deployment\
**Tags:** streamlit-cloud\
**Created:** [March 21, 2023, 9:47pm UTC](https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793 "2023-03-21T21:47:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jared\_Perez](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jared_perez/32/24378_2.png) [@Jared\_Perez](https://discuss.streamlit.io/u/Jared_Perez)\
**Post date:** [March 21, 2023, 9:47pm UTC](https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793/1 "2023-03-21T21:47:21Z")

</div>

Hello all, I am a bit of a newbie with all this so please bear with me 🙂

I am trying to deploy an app on streamlit cloud so my fitness clients can access workouts, log and track progress etc. Everything works perfectly locally but when I try and deploy to streamlit cloud I get an error in the first few lines of my app() when it is supposed to connect to my database. The error is

OSError: [Errno 8] Exec format error: ‘./cloud-sql-proxy’

The code that produces the error is:

def app():  
st.set\_page\_config(page\_title=“Cabral Fitness Exercise Prescriptions”)  
with st.spinner(‘Connecting to Cloud…Please Wait’):

```
    # Start the Cloud SQL proxy when the application starts
    proxy_process = subprocess.Popen(
    ['./cloud-sql-proxy', '--address', st.secrets.proxy_credentials.address, '--port', st.secrets.proxy_credentials.port, st.secrets.proxy_credentials.name])

    time.sleep(5) 

    conn = psycopg2.connect(**st.secrets.psycopg2_credentials)

```

I have been reading the Google Cloud SQL Auth proxy docs like crazy and feel like I am running in circles at this point. Any help would be greatly appreciated. The cloud-sql-proxy file does not seem to contain any important/secret information when I open it which is why I uploaded it to GitHub but perhaps I shouldn’t? I am sure it is running something special behind the scenes that allows it to work locally but not when i deploy to streamlit cloud. You can find the repo at:

> **[GitHub - jaredap1995/Data-Pipeline-and-Web-App-Exercise-Prescriptions: A full...](https://github.com/jaredap1995/Data-Pipeline-and-Web-App-Exercise-Prescriptions)**
>
> A full data pipeline developed from my personal hundreds of excel spreadsheets that were created during my time as a personal trainer. The Web Application is developed for clients to access any one...

---

<div class="post-metadata">

**Author:** ![Jared\_Perez](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jared_perez/32/24378_2.png) [@Jared\_Perez](https://discuss.streamlit.io/u/Jared_Perez)\
**Post date:** [March 22, 2023, 4:04am UTC](https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793/2 "2023-03-22T04:04:44Z")

</div>

I seemed to have solved it by adding all of streamlits outbound IP addresses (34.127.33.101 · 35.230.127.150 · 34.127.0.121 · 35.230.58.211 · 34.127.88.74 · 35.230.56.30.) as authorized networks in my SQL instance and then changing the psycopg2\_credentials to connect to the public id address of my SQL instance rather than a manual IP address I had been setting.

I had previously been setting my own IP and port with SQL Auth proxy as such:

```auto
./cloud-sql-proxy --address 0.0.0.0 --port 1234 [INSTANCE_CONNECTION_NAME]

```

---

<div class="post-metadata">

**Author:** ![Nathan\_Jones](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/nathan_jones/32/16677_2.png) [@Nathan\_Jones](https://discuss.streamlit.io/u/Nathan_Jones)\
**Post date:** [April 3, 2023, 8:31pm UTC](https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793/3 "2023-04-03T20:31:48Z")

</div>

We can’t find the IP addresses easily any longer inside of Streamlit’s documentation.

[Link explaining why](https://discuss.streamlit.io/t/link-to-ip-allowlist-documentation-is-broken/40648)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [April 2, 2024, 8:31pm UTC](https://discuss.streamlit.io/t/using-google-cloud-sql-auth-proxy-through-streamlit-cloud/39793/4 "2024-04-02T20:31:58Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
