Crie uma instância de VM Linux no Compute Engine

Saiba como criar uma instância de máquina virtual (VM) Linux no Compute Engine através da Google Cloud consola.


Para seguir orientações passo a passo para esta tarefa diretamente na Google Cloud consola, clique em Orientar-me:

Visita guiada


Antes de começar

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute Security Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Aceder ao IAM
    2. Selecione o projeto.
    3. Clique em Conceder acesso.
    4. No campo Novos responsáveis, introduza o identificador do utilizador. Normalmente, este é o endereço de email de uma Conta Google.

    5. Na lista Selecionar uma função, selecione uma função.
    6. Para conceder funções adicionais, clique em Adicionar outra função e adicione cada função adicional.
    7. Clique em Guardar.
  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute Security Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Aceder ao IAM
    2. Selecione o projeto.
    3. Clique em Conceder acesso.
    4. No campo Novos responsáveis, introduza o identificador do utilizador. Normalmente, este é o endereço de email de uma Conta Google.

    5. Na lista Selecionar uma função, selecione uma função.
    6. Para conceder funções adicionais, clique em Adicionar outra função e adicione cada função adicional.
    7. Clique em Guardar.
  8. Ative a API Compute Engine.

    Ative a API Compute Engine

Crie uma instância de VM Linux

  1. In the Google Cloud console, go to the Create an instance page.

    Go to Create an instance

  2. In the Boot disk section, click Change to begin configuring your boot disk.
  3. No separador Public images, escolha Ubuntu na lista Sistema operativo.
  4. Escolha Ubuntu 24.04 LTS na lista Versão.
  5. Clique em Selecionar.
  6. Na secção Firewall, selecione Permitir tráfego HTTP.
  7. Para criar a VM, clique em Criar.

Aguarde um curto período para que a instância de VM seja iniciada. Quando a instância de VM estiver pronta, é apresentada na página Instâncias de VM com um ícone de estado verde.

O Compute Engine concede a função roles/compute.instanceAdmin ao utilizador que cria a instância de VM. O Compute Engine também adiciona esse utilizador ao grupo sudo.

Estabeleça ligação à instância de VM

Estabeleça ligação a uma instância de VM através da Google Cloud consola e conclua os passos seguintes. Tem ligação à instância de VM como o utilizador que usou para aceder à página de instâncias de VM.

  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to.

    SSH button next to instance name.

Limpar

Para evitar incorrer em cobranças na sua Google Cloud conta pelos recursos usados nesta página, siga estes passos.

  1. Na Google Cloud consola, aceda à página Instâncias de VM.

    Aceder às instâncias de VM

  2. Selecione a linha que contém a instância de VM que criou neste tutorial.

  3. Clique em Eliminar e, de seguida, clique em Eliminar para confirmar.

O que se segue?