Back to controls

Ensure Cloud SQL database instances do not have public IPs

It is recommended to configure Second Generation Sql instance to use private IPs instead of public IPs.

Category

Controls

Medium

Applies to

Google Cloud

Coverage

null controls, 1 queries

Asset types

1 covered

Overview

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.

Remediation guidance

From Google Cloud Console

  1. Go to the Cloud SQL Instances page in the Google Cloud Console by visiting https://console.cloud.google.com/sql/instances
  2. Select the instance name to open its Overview page
  3. Navigate to Connections, and then to NETWORKING
  4. Deselect the Public IP checkbox
  5. Click Save

From Google Cloud CLI

  1. For every instance, remove its public IP and assign a private IP instead:
gcloud sql instances patch <instanceName> --network= --noassign-ip
  1. Confirm the changes using the following command:
gcloud sql instances describe <instanceName>

Prevention

To prevent new SQL instances from getting configured with public IP addresses, set up a Restrict Public IP access on Cloud SQL instances Organization policy at: https://console.cloud.google.com/iam-admin/orgpolicies/sql-restrictPublicIp.

Default Value

By default, Cloud Sql instances have a public IP.

References

  1. https://cloud.google.com/sql/docs/mysql/configure-private-ip
  2. https://cloud.google.com/sql/docs/mysql/private-ip
  3. https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints
  4. https://console.cloud.google.com/iam-admin/orgpolicies/sql-restrictPublicIp

Addititonal information

Replicas inherit their private IP status from their primary instance. You cannot configure a private IP directly on a replica.

Multiple Remediation Paths

Google Cloud

SERVICE-WIDE (RECOMMENDED when many resources are affected): Enforce Organization Policies at org/folder level so new resources inherit secure defaults.

gcloud org-policies set-policy policy.yaml

ASSET-LEVEL: Use the product-specific remediation steps above for only the impacted project/resources.

PREVENTIVE: Use org policy constraints/custom constraints and enforce checks in deployment pipelines.

References for Service-Wide Patterns

  • GCP Organization Policy overview: https://cloud.google.com/resource-manager/docs/organization-policy/overview
  • GCP Organization policy constraints catalog: https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints
  • gcloud org-policies: https://cloud.google.com/sdk/gcloud/reference/org-policies

Operational Rollout Workflow

Use this sequence to reduce risk and avoid repeated drift.

1. Contain at Service-Wide Scope First (Recommended)

  • Google Cloud: apply organization policy constraints at org/folder scope.
gcloud org-policies set-policy policy.yaml

2. Remediate Existing Affected Assets

  • Execute the control-specific Console/CLI steps documented above for each flagged resource.
  • Prioritize internet-exposed and production assets first.

3. Validate and Prevent Recurrence

  • Re-scan after each remediation batch.
  • Track exceptions with owner and expiry date.
  • Add preventive checks in IaC/CI pipelines.

Query logic

These are the stored checks tied to this control.

Cloud SQL database instances do not have public IPs

Connectors

Google Cloud

Covered asset types

CloudSQLInstance

Expected check: eq []

{cloudSqlInstances(where:{instanceType:"CLOUD_SQL_INSTANCE",backendType:"SECOND_GEN",ipAddresses_SOME:{type:"PRIMARY"}}){...AssetFragment}}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon