Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Conectar-se a uma VM do TPU sem um endereço IP público
Se a sua organização tiver uma restrição de política
constraints/compute.vmExternalIpAccess, será necessário criar VMs de TPU que não tenham um endereço IP externo. Para se conectar a uma VM da TPU sem um endereço IP externo, você precisa fazer o seguinte:
Conceda roles/iap.tunnelResourceAccessor e roles/tpu.admin aos usuários que
vão se conectar às VMs da TPU.
Crie uma VM TPU sem um endereço IP público.
Conecte-se à VM do TPU usando a opção --tunnel-through-iap.
ativar o Acesso privado do Google
Para usar um IAP, ative o Acesso privado do Google, que permite a conexão
com VMs que não têm endereços IP externo. No comando abaixo, substitua your-subnet pelo nome da sub-rede em que você vai criar a VM da TPU e your-region pela região em que a VM da TPU vai estar localizada.
Os usuários que precisam se conectar às VMs da TPU usando SSH e que não têm endereços IP públicos precisam receber o papel iap.tunnelResourceAccessor. Para mais informações sobre como conceder um papel, consulte
Conceder um papel do IAM.
Criar uma VM TPU sem um endereço IP público
O comando a seguir mostra como criar uma VM TPU sem um endereço IP público.
[[["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-08-18 UTC."],[],[],null,["# Connect to a TPU VM without a public IP address\n===============================================\n\nIf your organization has a `constraints/compute.vmExternalIpAccess` organization\npolicy constraint, you need to create TPU VMs that don't have an external IP\naddress. To connect to a TPU VM without an external IP address, you need to:\n\n1. Enable [Private Google Access](/vpc/docs/private-google-access) for the subnet where you will create a TPU VM.\n2. Grant `roles/iap.tunnelResourceAccessor` and `roles/tpu.admin` to users who will connect to the TPU VMs.\n3. Create a TPU VM without a public IP address.\n4. Connect to your TPU VM using `--tunnel-through-iap` option.\n\nEnable Private Google Access\n----------------------------\n\nTo use an IAP, you must enable Private Google Access which lets you connect\nto VMs that don't have external IP addresses. In the following command replace\n\u003cvar translate=\"no\"\u003eyour-subnet\u003c/var\u003e with the name of the subnet where you will create the TPU\nVM and \u003cvar translate=\"no\"\u003eyour-region\u003c/var\u003e with the region where the TPU VM will be located. \n\n```bash\ngcloud compute networks subnets update your-subnet \\\n--region=your-region \\\n--enable-private-ip-google-access\n```\n\nGrant permissions\n-----------------\n\nUsers that need to connect to the TPU VMs using SSH that don't have public IP\naddresses must be granted the iap.tunnelResourceAccessor role. For more\ninformation about granting a role, see\n[Granting an IAM Role](/iam/docs/granting-changing-revoking-access#grant-single-role).\n\nCreate a TPU VM without a public IP address\n-------------------------------------------\n\nThe following command shows how to create a TPU VM with no public IP address. \n\n```bash\ngcloud compute tpus tpu-vm create tpu-vm-name \\\n --zone $ZONE \\\n --project your-project \\\n --internal-ips \\\n --version tpu-vm-tf-2.17.1-pjrt \\\n --accelerator-type v2-8 \\\n --subnetwork your-subnet \\\n```\n\nConnect to your TPU VM using SSH with IAP tunneling\n---------------------------------------------------\n\nThe following command shows how to connect to a TPU VM using IAP tunneling. \n\n```bash\ngcloud alpha compute tpus tpu-vm ssh tpu-vm-name --tunnel-through-iap\n```"]]