Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Using IAM to connect a SA account to a Postgres SQL instance from VM in Compute Engine

I'm trying to connect from Python from a Compute Engine VM to a Postgresql storage instance and I continue to get the following error even after making the recommended changes.  

"ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message="Forbidden: Authenticated IAM principal does not seeem authorized to make API request. Verify 'Cloud SQL Admin API' is enabled within your GCP project and 'Cloud SQL Client' role has been granted to IAM principal."

My connection uses the following parameters:

# function to return the database connection object
def getconn():
conn = connector.connect(
'INSTANCE:LOCATION',
"pg8000",
user='sa-****',
db='postgres',
enable_iam_auth = True
)
return conn

Any suggestions for troubleshooting this issue?

Thanks,
Eric

4 4 2,289