Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Esta página le muestra cómo inicializar la CLI de gcloud.
Después de instalar la CLI de gcloud, ejecute gcloud init para la configuración inicial. También puede ejecutar gcloud init para cambiar la configuración o crear una nueva.
gcloud init realiza los siguientes pasos de configuración:
Autoriza a la CLI de gcloud a utilizar las credenciales de su cuenta de usuario para acceder Google Cloud, o le permite seleccionar una cuenta si ha autorizado previamente el acceso
Establece una configuración CLI de gcloud y establece un conjunto base de propiedades , incluida la cuenta activa del paso anterior, el proyecto actual y, si corresponde, la región y zona predeterminadas de Compute Engine.
Puede ejecutar lo siguiente como alternativa a gcloud init :
Crear y administrar configuraciones y propiedades de gcloud CLI.
Inicializar la CLI de gcloud
Para inicializar la CLI de gcloud:
Ejecute gcloud init :
gcloud init
Si está en una sesión de terminal remota, puede usar el indicador --no-launch-browser para evitar que el comando inicie un flujo de autorización basado en navegador, si es necesario:
gcloud init --no-launch-browser
Cree o seleccione una configuración si se le solicita.
Si está inicializando una nueva instalación de gcloud CLI, gcloud init crea una configuración default y la establece como activa. Si ya tiene configuraciones, gcloud init le pedirá que elija entre tres opciones: reinicializar la activa, cambiar a otra y reinicializarla, o crear una nueva.
Complete el paso de autorización cuando se le solicite.
Dependiendo de si usted ha autorizado previamente el acceso aGoogle CloudEs posible que se le solicite iniciar sesión y otorgar acceso en un navegador web o seleccionar una cuenta existente.
Si utilizó el indicador --no-launch-browser y se requiere iniciar sesión, deberá copiar y pegar la URL de autorización proporcionada en otra ventana del navegador y seguir las instrucciones.
Cuando se completa este paso, gcloud init establece la propiedad account en la configuración de la cuenta especificada.
Elige una corriente Google Cloud proyecto si se le solicita.
Si solo tiene acceso a un proyecto, incluido el proyecto predeterminado para su cuenta de usuario, gcloud init lo selecciona por usted.
De lo contrario, puede seleccionar un proyecto de una lista de proyectos para los que tenga permisos de Propietario , Editor o Visualizador . gcloud init establece la propiedad project en la configuración con la que elija. Si tiene acceso a más de 200 proyectos, se le solicitará que introduzca un ID de proyecto, cree un nuevo proyecto o enumere los proyectos.
This account has a lot of projects! Listing them all can take a while.
[1] Enter a project ID
[2] Create a new project
[3] List projects
Please enter your numeric choice:
Elija una zona de Compute Engine predeterminada si se le solicita.
Si no tiene habilitada la API de Compute Engine o ya tiene una zona predeterminada en los metadatos a nivel de proyecto , no verá este paso. gcloud init establece las propiedades region y zone en la configuración usando la zona que elija.
Para ver las propiedades establecidas a través del comando gcloud init , utilice el comando gcloud config list .
[compute]
region = us-east1
zone = us-east1-b
[core]
account = dana@example.com
disable_usage_reporting = False
project = example-project
Para obtener más información sobre cómo autorizar las credenciales predeterminadas de la aplicación (ADC) para las bibliotecas de cliente de Cloud (y las bibliotecas de cliente de API de Google), consulte Configurar las credenciales predeterminadas de la aplicación .
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-06-11 (UTC)."],[],[],null,["# Initializing the gcloud CLI\n\nThis page shows you how to initialize the gcloud CLI.\n\nAfter you install the gcloud CLI, perform initial setup tasks by running\n[`gcloud init`](/sdk/gcloud/reference/init). You can also run `gcloud init`\nto change your settings or create a new configuration.\n\n`gcloud init` performs the following setup steps:\n\n- [Authorizes](/sdk/docs/authorizing) the gcloud CLI to use your user account credentials to access Google Cloud, or lets you select an account if you have previously authorized access\n- Sets up a gcloud CLI [configuration](/sdk/docs/configurations) and sets a base set of [properties](/sdk/docs/properties), including the active account from the step above, the current project, and if applicable, the default Compute Engine region and zone\n\nYou can run the following as alternatives to `gcloud init`:\n\nInitialize the gcloud CLI\n-------------------------\n\nTo initialize the gcloud CLI:\n\n1. Run `gcloud init`:\n\n gcloud init\n\n If you are in a remote terminal session, you can use the `--no-launch-browser`\n flag to prevent the command from launching a browser-based authorization\n flow, if required: \n\n gcloud init --no-launch-browser\n\n2. Create or select a configuration if prompted.\n\n If you are initializing a new gcloud CLI installation,\n `gcloud init` creates a configuration named `default` for you and sets\n it as the active configuration. If you have existing configurations,\n `gcloud init` prompts you to choose between three options ---\n re-initialize the active one, switch to another one and re-initialize it, or\n create a new one.\n3. Complete the authorization step when prompted.\n\n Depending on whether you have previously authorized access to\n Google Cloud, you might be prompted to log in and grant access in a\n web browser or to select an existing account.\n\n If you used the `--no-launch-browser` flag and login is required,\n you must then copy and paste the provided authorization URL into another\n browser window and follow the prompts provided.\n\n When this step is completed, `gcloud init` sets the `account` property in\n the configuration to the specified account.\n4. Choose a current Google Cloud project if prompted.\n\n If you only have access to one project, including the default project for\n your user account, `gcloud init` selects it for you.\n\n Otherwise, you can\n select a project from a list of projects for which you have **Owner** ,\n **Editor** or **Viewer** permissions. `gcloud init` sets the `project`\n property in the configuration to the property you choose. If you have\n access to more than 200 projects, you will be prompted to enter\n a project id, create a new project, or list projects. \n\n ```\n This account has a lot of projects! Listing them all can take a while.\n [1] Enter a project ID\n [2] Create a new project\n [3] List projects\n Please enter your numeric choice:\n ```\n | **Note:** If you choose to create a project, you'll also need to [enable billing on your project](/billing/docs/how-to/modify-project) to use Google Cloud services.\n5. Choose a default Compute Engine zone if prompted.\n\n If you don't have the Compute Engine API enabled or you already\n have a default zone in your\n [project-level metadata](/compute/docs/metadata), you will not see this\n step. `gcloud init` sets the `region` and `zone` properties in the\n configuration using the zone you choose.\n\nTo view the properties set through the `gcloud init` command, use the\n[`gcloud config list`](/sdk/gcloud/reference/config/list) command. \n\n```sh\n[compute]\nregion = us-east1\nzone = us-east1-b\n[core]\naccount = dana@example.com\ndisable_usage_reporting = False\nproject = example-project\n```\n\nWhat's next\n-----------\n\n- To learn more about tool authorization, see [Authorizing the gcloud CLI](/sdk/docs/authorizing).\n- To learn more about authorizing Application Default Credentials (ADC) for Cloud Client Libraries (and Google API Client Libraries), see [Set up Application Default Credentials](/docs/authentication/provide-credentials-adc#how-to).\n- To learn more about managing configurations, see [gcloud CLI configurations](/sdk/docs/configurations).\n- To learn more about managing properties, see [gcloud CLI properties](/sdk/docs/properties)."]]