I'm trying to connect my app engine flex service to the cloud sql database that is in a shared project.
I have added the app engine default and app engine flex user as SQL admin to the shared project.
Now I'm trying to connect the app engine container to the cloud sql instance with the following connection string:
"Server=cloudsql;Database=cliche;User Id=user;Password=password;"
However, the connection always fails with the given connection string.
[13:57:37 ERR] An error occurred using the connection to database 'cliche' on server 'cloudsql'.
[13:57:37 ERR] An exception occurred while iterating over the results of a query for context type 'IKL.Data.ApplicationDbContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
As requested I provide the app.yaml here:
runtime: aspnetcore
env: flex
service: platform
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 1.5
disk_size_gb: 10
beta_settings:
cloud_sql_instances: shared-resources-291914:europe-west3:edutec-mssql=tcp:1433