Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Se você tiver a CLI gcloud instalada, poderá interagir
com o Cloud Shell no terminal e usá-lo como uma sandbox e um
ambiente de desenvolvimento portátil. Isso gera a conveniência de trabalhar com os recursos do Cloud Shell, seja para testar rapidamente uma operação ou usar um ambiente de desenvolvimento integrado de sua escolha para editar um arquivo salvo na sua instância do Cloud Shell na área de trabalho local.
Usar gcloud cloud-shell
A oferta atual do grupo de comandos gcloud cloud-shell fornece a seguinte funcionalidade:
Como estabelecer uma sessão SSH interativa com o Cloud Shell usando gcloud cloud-shell ssh.
Copie arquivos entre sua máquina local e a do Cloud Shell via scp.
Monte o diretório do Cloud Shell no seu sistema de arquivos local via sshfs.
Para mais detalhes, consulte a documentação de referência para gcloud cloud-shell.
Exemplo de fluxo de trabalho
Para ilustrar o funcionamento de gcloud cloud-shell, veja um exemplo de como você pode usar estes comandos na prática:
Inicie uma sessão SSH:
gcloud cloud-shell ssh
Copie um arquivo data.txt do Cloud Shell para sua máquina local:
Se você estiver usando Mac ou Linux, poderá montar o diretório inicial do Cloud Shell no sistema de arquivos local depois de instalar sshfs.
Isso permite que você edite os arquivos no diretório inicial do Cloud Shell usando suas ferramentas locais. Todos os dados do seu sistema de arquivos montado remotamente são armazenados em um Disco permanente e armazenados em todas as sessões.
[[["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-09-01 UTC."],[],[],null,["# Use Cloud Shell with the gcloud CLI\n\nIf you have the [gcloud CLI installed](/sdk/install), you can interact\nwith Cloud Shell from your terminal and use it as a sandbox and a\nportable development environment. This provides the convenience of working\nwith Cloud Shell resources, whether to quickly test an operation\nor use an IDE of your choice to edit a file saved on your\nCloud Shell instance from your local desktop.\n\nUse `gcloud cloud-shell`\n------------------------\n\nThe current `gcloud cloud-shell` command group offering provides the following\nfunctionality:\n\n- Establishing an interactive SSH session with Cloud Shell using [`gcloud cloud-shell ssh`](/sdk/gcloud/reference/cloud-shell/ssh).\n- Copy files between your local and Cloud Shell machine via [scp](/sdk/gcloud/reference/cloud-shell/scp).\n- Mount your Cloud Shell directory to your local file system via [sshfs](/sdk/gcloud/reference/cloud-shell/get-mount-command).\n\nFor more detail, see the reference documentation for\n[`gcloud cloud-shell`](/sdk/gcloud/reference/cloud-shell).\n| **Note:** To propagate your credentials to your Cloud Shell when starting it from the Google Cloud CLI, use the [`--authorize-session`](/sdk/gcloud/reference/cloud-shell/ssh#--authorize-session) flag when running the `gcloud cloud-shell ssh` command.\n\nExample workflow\n----------------\n\nTo illustrate the workings of `gcloud cloud-shell`, here is an example of how\nyou can use these commands in practice:\n\n1. Start a SSH session:\n\n gcloud cloud-shell ssh\n\n2. Copy a file, `data.txt`, from Cloud Shell to your local machine:\n\n gcloud cloud-shell scp cloudshell:~/data.txt localhost:~data.txt\n\n3. If you're using Mac or Linux, you can mount your Cloud Shell home\n directory onto your local file system after installing\n [sshfs](https://github.com/libfuse/sshfs).\n\n This allows you to edit the files in your Cloud Shell home directory using\n your choice of local tools. All the data in your remotely mounted file\n system is stored on a [Persistent Disk](/persistent-disk)\n and stored across sessions. \n\n gcloud cloud-shell get-mount-command ~/my-cloud-shell"]]