title: Accessing Cloud SQL from Cloud Run on Google Cloud
body: <p>I have a Cloud Run service that accesses a Cloud SQL instance through <code>SQLAlchemy</code>. However, in the logs for Cloud Run, I see <code>CloudSQL connection failed. Please see https://cloud.google.com/sql/docs/mysql/connect-run for additional details: ensure that the account has access to &quot;&lt;connection_string&gt;&quot;</code>. Going to that link, it says that:</p>
  <p>&quot;By default, your app will authorize your connections using the Cloud Run (fully managed) service account. The service account is in the format PROJECT_NUMBER-compute@developer.gserviceaccount.com.&quot;</p>
  <p>However, the following (<a href="https://cloud.google.com/run/docs/securing/service-identity" rel="nofollow noreferrer">https://cloud.google.com/run/docs/securing/service-identity</a>) says:</p>
  <p>&quot;By default, Cloud Run revisions are using the Compute Engine default service account (PROJECT_NUMBER-compute@developer.gserviceaccount.com), which has the Project &gt; Editor IAM role. This means that by default, your Cloud Run revisions have read and write access to all resources in your Google Cloud project.&quot;</p>
  <p>So shouldn't that mean that Cloud Run can already access SQL? I've already set up the Cloud SQL Connection in the Cloud Run deployment page. What do you suggest I do to allow access to Cloud SQL from Cloud Run?</p>
  <p>EDIT: I have to enable the Cloud SQL API.</p>