🛡️ Google Cloud SQL Instance has public IP addresses🟢
- Contextual name: 🛡️ Instance has public IP addresses🟢
- ID:
/ce/ca/google/sql/instance-with-public-ip - Tags:
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logic
Similar Policies
- Cloud Conformity: Check for Cloud SQL Database Instances with Public IPs
Description
Description
It is recommended to configure second generation SQL instances to use private IPs instead of public IPs.
Rationale
To lower the organization's attack surface, Cloud SQL databases should not have public IPs. Private IPs provide improved network security and lower latency for your application.
Impact
Removing the public IP address on SQL instances may break some applications that relied on it for database connectivity.
Audit
From Google Cloud Console
- Go to the Cloud SQL Instances page in the Google Cloud Console: https://console.cloud.google.com/sql/instances
- Ensure that every instance has a private IP address and no public IP address configured.
From Google Cloud CLI
List all Cloud SQL database instances using the following command:
gcloud sql instances listFor every instance of type
instanceType: CLOUD_SQL_INSTANCEwithbackendType: SECOND_GEN, get detailed configuration. Ignore instances of typeREAD_REPLICA_INSTANCEbecause these instances inherit their settings from the primary instance. Also, note that first generation instances cannot be configured to have a private IP address.... see more
Remediation
Remediation
From Google Cloud Console
- Go to the Cloud SQL Instances page in the Google Cloud Console: https://console.cloud.google.com/sql/instances
- Click the instance name to open its Instance details page.
- Select the
Connectionstab.- Deselect the
Public IPcheckbox.- Click
Saveto update the instance.From Google Cloud CLI
For every instance, remove its public IP and assign a private IP instead:
gcloud sql instances patch {{instance-name}} \
--network={{vpc-network-name}} \
--no-assign-ipConfirm the changes using the following command:
gcloud sql instances describe {{instance-name}}