โญ Repository โ ๐ Compliance Engine โ ๐ CloudAware โ ๐ Google โ ๐ Cloud SQL
๐ก๏ธ 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 with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY
- Policy Categories:
SECURITY
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: Check for Cloud SQL Database Instances with Public IPs
Descriptionโ
Descriptionโ
It is recommended to configure Second Generation Sql instance 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 list
For every instance of type
instanceType: CLOUD_SQL_INSTANCE
withbackendType: SECOND_GEN
, get detailed configuration. Ignore instances of typeREAD_REPLICA_INSTANCE
because 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
Connections
tab.- Deselect the
Public IP
checkbox.- Click
Save
to 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-ip
Confirm the changes using the following command:
gcloud sql instances describe <INSTANCE_NAME>