Terence Chow
Terence Chow

Reputation: 11173

Allow App Engine Standard Environment to connect to Compute Engine Mysql

I have a mysql container on my compute engine and I would like my App Engine to be able communicate with it.

I'm using django and have the below settings

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'HOST': <---ACTUAL_IP_REMOVED -->,
        'NAME': 'name_of_my_database',
        'USER': 'root',
        'PASSWORD': <-- Actual password removed -->,
        'PORT': '3306'
    }
}

I also have a firewall rule that allows all ingress on tcp:3306 for target service account (my google compute service account) and for source service account (my app engine service account).

Despite this I still get the below error in my app engine logs.

OperationalError: (2003, "Can't connect to MySQL server on '<--IP-Address-removed--->' (110)")

What am I overlooking / doing wrong?

Upvotes: 2

Views: 510

Answers (1)

Mangu
Mangu

Reputation: 3325

You also have to allow the remote connections in the SQL instance. Try to follow the steps described in here, replacing the data in the answer with your data.

Upvotes: 0

Related Questions