IAM authentication

MySQL  |  PostgreSQL  |  SQL Server

Google Cloud offers Identity and Access Management (IAM), which lets you giveaccess to specific Google Cloud resources and prevent unwantedaccess to other resources. This page describes how Cloud SQL is integrated withIAM and how you can use IAM for managing access to Cloud SQLresources and for database authentication.For a detailed description of Google Cloud IAM, seeIAM documentation.

Cloud SQL provides a set ofpredefined rolesdesigned to help you control access to your Cloud SQL resources. You canalso create your owncustom roles,if the predefined roles don't provide the sets of permissions you need.In addition, the legacy basic roles (Editor, Viewer, and Owner) are also stillavailable to you, although they don't providethe same fine-grained control as the Cloud SQL roles. In particular, thebasic roles provide access to resources across Google Cloud, rather than justfor Cloud SQL. For more information about basic Google Cloud roles, seeBasic roles.

You can set an IAM policy at any level in theresource hierarchy: theorganization level, the folder level, or the project level.Resources inherit the policies of all of their parent resources.

IAM references for Cloud SQL

IAM authentication concepts

When using IAM authentication, permission to access a resource(a Cloud SQL instance) isn't granteddirectly to the end user. Instead,permissions are grouped intoroles, and roles are granted toprincipals. Formore information, see theIAM overview.

Administrators who have users log in through IAM database authentication can useIAM authentication to centrally manage access control to their instancesusing IAM policies.

IAM policies involve the following entities:

  • Principals. In Cloud SQL, you can use severaltypes of principals: auser account, aservice account(for applications), or agroup.For more information, seeConcepts related to identity.
  • Roles. A role is a collection of permissions. You can grant roles toprincipals to provide them with the privileges required to accomplishspecific tasks. For example, with IAM database authentication, a principal requiresthecloudsql.instances.login permission to log in to an instance, which isincluded in theCloud SQL Instance User role.To get the permission, you bind the user, service account,or group to the predefined Cloud SQL role or a custom role thatincludes the permission. For more information about IAM roles,seeRoles.
  • Resource. The resources that principals access are Cloud SQLinstances. By default, IAM policy bindings are applied at theproject-level, such that principals receive role permissions for allCloud SQL instances in the project.

IAM database authentication

Database authentication is the process of verifying the identity of a user who isattempting to access databases. In Cloud SQL, you can use the followingtypes of database authentication for database users:

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-24 UTC.