Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página mostra como inicializar o gcloud CLI.
Após instalar a CLI do gcloud, execute as tarefas de configuração inicial executando gcloud init . Você também pode executar gcloud init para alterar suas configurações ou criar uma nova.
gcloud init executa as seguintes etapas de configuração:
Autoriza o gcloud CLI a usar as credenciais da sua conta de usuário para acessar Google Cloud, ou permite que você selecione uma conta se você já tiver autorizado o acesso
Define uma configuração de CLI do gcloud e define um conjunto base de propriedades , incluindo a conta ativa da etapa acima, o projeto atual e, se aplicável, a região e a zona padrão do Compute Engine.
Você pode executar o seguinte como alternativa ao gcloud init :
Crie e gerencie configurações e propriedades do gcloud CLI.
Inicializar o gcloud CLI
Para inicializar o gcloud CLI:
Execute gcloud init :
gcloud init
Se você estiver em uma sessão de terminal remoto, poderá usar o sinalizador --no-launch-browser para impedir que o comando inicie um fluxo de autorização baseado em navegador, se necessário:
gcloud init --no-launch-browser
Crie ou selecione uma configuração, se solicitado.
Se você estiver inicializando uma nova instalação do gcloud CLI, gcloud init criará uma configuração chamada default e a definirá como a configuração ativa. Se você já tiver configurações, gcloud init solicitará que você escolha entre três opções: reinicializar a configuração ativa, alternar para outra e reinicializá-la ou criar uma nova.
Conclua a etapa de autorização quando solicitado.
Dependendo se você autorizou previamente o acesso aGoogle Cloud, você pode ser solicitado a efetuar login e conceder acesso em um navegador da web ou a selecionar uma conta existente.
Se você usou o sinalizador --no-launch-browser e o login for necessário, você deve copiar e colar o URL de autorização fornecido em outra janela do navegador e seguir as instruções fornecidas.
Quando esta etapa estiver concluída, gcloud init definirá a propriedade account na configuração para a conta especificada.
Escolha uma corrente Google Cloud projeto se solicitado.
Se você tiver acesso apenas a um projeto, incluindo o projeto padrão da sua conta de usuário, gcloud init o selecionará para você.
Caso contrário, você pode selecionar um projeto de uma lista de projetos para os quais possui permissões de Proprietário , Editor ou Visualizador . gcloud init define a propriedade project na configuração para a propriedade que você escolher. Se você tiver acesso a mais de 200 projetos, será solicitado a inserir um ID de projeto, criar um novo projeto ou listar projetos.
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:
Escolha uma zona padrão do Compute Engine, se solicitado.
Se você não tiver a API do Compute Engine habilitada ou já tiver uma zona padrão nos metadados do nível do projeto , não verá esta etapa. gcloud init define as propriedades region e zone na configuração usando a zona escolhida.
Para visualizar as propriedades definidas pelo comando gcloud init , use o 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 saber mais sobre como autorizar Credenciais Padrão do Aplicativo (ADC) para Bibliotecas de Cliente do Cloud (e Bibliotecas de Cliente da API do Google), consulte Configurar Credenciais Padrão do Aplicativo .
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]