We can connect to a Cloud SQL instance using SSL. This comes in handy when we don't want to manually access it, but want our application to access the SQL automatically. Cloud SQL uses two certificates; self-signed on server side and public/private key pair on client side for authentication. This enables encryption on the communication between Server and Client. You must have both a valid server certificate and a valid client certificate (key pair) to support encrypted communication. Use the following steps to interact with certificates:
- Configure the instance to mandate SSL connection:
gcloud sql instances patch bank-balance --require-ssl
- Create an SSL certificate and store the key securely on your system or bucket if you trust the role owners:
gcloud sql ssl-certs create bank-balance-cert client-key.pem --instance bank-balance...