Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In diesem Dokument wird beschrieben, wie Sie VPC Service Controls mit Batch verwenden.
Mit VPC Service Controls können Sie die Ressourcen und Daten von Google Cloud Diensten schützen, indem Sie bestimmte Ressourcen in Dienstperimeter isolieren. Ein Dienstperimeter blockiert Verbindungen mit Google Cloud Diensten außerhalb des Perimeters und alle Verbindungen aus dem Internet, die nicht explizit zugelassen sind.
Informationen zum Konfigurieren eines VPC Service Controls-Dienstperimeters für die Verwendung von Batch finden Sie in diesem Dokument unter Dienstperimeter für Batch konfigurieren.
Wenn in Ihrem Projekt oder Netzwerk VPC Service Controls verwendet werden, um den Netzwerkzugriff für Batch einzuschränken, müssen Sie Ihre Batch-Jobs so konfigurieren, dass sie im erforderlichen Dienstperimeter ausgeführt werden.
Informationen dazu finden Sie unter Job erstellen, der in einem Dienstperimeter ausgeführt wird in diesem Dokument.
Weitere Informationen zu Netzwerkkonzepten und dazu, wann Sie das Netzwerk konfigurieren sollten, finden Sie unter Übersicht über Batch-Netzwerke.
Bitten Sie Ihren Administrator, Ihnen die folgenden IAM-Rollen zuzuweisen, um die Berechtigungen zu erhalten, die Sie zur Verwendung von VPC Service Controls mit Batch benötigen:
So ermitteln Sie den Dienstperimeter für ein Projekt oder Netzwerk:
Access Context Manager Reader (roles/accesscontextmanager.policyReader)
für das Projekt
So ermitteln Sie das Netzwerk und das Subnetz für einen Job:
Compute-Netzwerkbetrachter (roles/compute.networkViewer)
für das Projekt
Wenn Sie einen Job erstellen, der in einem Dienstperimeter ausgeführt wird, müssen Sie das Netzwerk angeben, das Sie für den Job verwenden möchten. Das Netzwerk, das Sie für einen Job angeben, der in einem Dienstperimeter ausgeführt wird, muss die folgenden Anforderungen erfüllen:
Das Netzwerk enthält ein Subnetzwerk (Subnetz) an dem Ort, an dem Sie den Job ausführen möchten.
Das Netzwerk befindet sich im erforderlichen Dienstperimeter und verwendet den privater Google-Zugriff, um den Zugriff auf die Domains für die APIs und Dienste zu ermöglichen, die von Ihrem Job verwendet werden. Weitere Informationen finden Sie in diesem Dokument unter Dienstperimeter für Batch konfigurieren.
So konfigurieren Sie einen Dienstperimeter für Batch:
Planen Sie die Konfiguration für Ihren Dienstperimeter. Eine Übersicht über die Konfigurationsphasen für Dienstperimeter finden Sie in der VPC Service Controls-Dokumentation unter Details und Konfiguration von Dienstperimetern.
Damit Sie Batch verwenden können, muss der Dienstperimeter die folgenden Anforderungen erfüllen:
Eingeschränkte Dienste:Wenn Sie Batch innerhalb eines Dienstperimeters schützen möchten, müssen Sie die Google Cloud -Dienste, die für Ihre Batch-Jobs erforderlich sind, in diesen Perimeter aufnehmen, z. B. die folgenden Dienste:
Batch API (batch.googleapis.com)
Cloud Logging API (logging.googleapis.com): Erforderlich, wenn Ihre Jobs Logs in Cloud Logging schreiben sollen. (Empfohlen)
Container Registry API (containerregistry.googleapis.com):
Erforderlich, wenn Sie einen Job einreichen, in dem Container mit einem Image aus Container Registry verwendet werden.
Artifact Registry API (artifactregistry.googleapis.com): Erforderlich, wenn Sie einen Job einreichen, in dem Container mit einem Image aus Artifact Registry verwendet werden.
Filestore API (file.googleapis.com): Erforderlich, wenn in Ihrem Job eine Filestore-Dateifreigabe verwendet wird.
Cloud Storage API (storage.googleapis.com): Erforderlich für einige Jobs, die einen Cloud Storage-Bucket verwenden.
Erforderlich, wenn Sie für Ihren Batchjob ein Image verwenden, auf dem der Batch-Dienst-Agent nicht vorinstalliert ist.
Informationen zum Aktivieren der einzelnen Dienste in Ihrem Dienstperimeter finden Sie unter Über VPC zugängliche Dienste.
VPC-Netzwerke:Für jeden Batch-Job ist ein VPC-Netzwerk erforderlich. Ihr Dienstperimeter muss also ein VPC-Netzwerk enthalten, in dem Batch-Jobs ausgeführt werden können. Informationen zum Konfigurieren eines VPC-Netzwerk, in dem Ihre Batch-Jobs innerhalb eines Dienstperimeters ausgeführt werden können, finden Sie in den folgenden Dokumenten:
Informationen dazu, wie Sie den privater Google-Zugriff mit VPC Service Controls verwenden, um den Zugriff auf die für Ihre Batch-Jobs erforderlichen Google Cloud-Dienste zu konfigurieren, finden Sie unter Private Verbindung zu Google APIs und Google-Diensten einrichten.
Weitere Informationen zu den Netzwerkanforderungen für Batch-Jobs finden Sie unter Job-Netzwerk – Übersicht.
Job erstellen, der in einem Dienstperimeter ausgeführt wird
Wenn Sie einen Job erstellen, der in einem Dienstperimeter ausgeführt wird, müssen Sie auch den externen Zugriff für alle VMs blockieren, auf denen ein Job ausgeführt wird, und ein Netzwerk und ein Subnetz angeben, über die der Job auf die erforderlichen APIs zugreifen kann.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-12 (UTC)."],[[["\u003cp\u003eVPC Service Controls protect Google Cloud resources by isolating them within service perimeters, blocking unauthorized connections.\u003c/p\u003e\n"],["\u003cp\u003eTo use Batch within a service perimeter, configure the perimeter to include necessary Google Cloud services like the Batch API, Cloud Logging API, and others depending on the job's needs.\u003c/p\u003e\n"],["\u003cp\u003eBatch jobs within a service perimeter require a VPC network that is also within the perimeter and uses Private Google Access.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating Batch jobs that run within a service perimeter, you must specify a network and subnet that allows access to required APIs and blocks external access for all VMs.\u003c/p\u003e\n"],["\u003cp\u003eDefault Batch VM OS images are recommended when using jobs with VPC Service Controls, as Batch does not guarantee support for custom VM OS images.\u003c/p\u003e\n"]]],[],null,["# Use VPC Service Controls with Batch\n\nThis document explains how to use VPC Service Controls with Batch.\n[VPC Service Controls](/vpc-service-controls/docs/overview#capabilities)\nallows you to protect the resources and data of Google Cloud services\nby isolating specific resources into service perimeters. A service\nperimeter blocks connections with Google Cloud services outside\nthe perimeter and any connections from the internet that are not explicitly\nallowed.\n\n- To configure a VPC Service Controls service perimeter to use Batch, see [Configure a service perimeter for Batch](#configure-service-perimeter) in this document.\n- If your project or network uses VPC Service Controls to restrict networking access for Batch, you must configure your Batch jobs to run in the required service perimeter. To learn how, see [Create a job that runs in a service perimeter](#create-job-service-perimeter) in this document.\n\nFor more information about networking concepts and\nwhen to configure networking, see\n[Batch networking overview](/batch/docs/networking-overview).\n| **Caution:** Batch does not guarantee VPC Service Controls support for jobs with custom VM OS images. Only default Batch VM OS images are recommended for jobs that use VPC Service Controls. For more information about VM OS images and how to restrict VM OS images, see [VM OS environment overview](/batch/docs/vm-os-environment-overview).\n\nBefore you begin\n----------------\n\n1. If you haven't used Batch before, review [Get started with Batch](/batch/docs/get-started) and enable Batch by completing the [prerequisites for projects and users](/batch/docs/get-started#prerequisites).\n2.\n\n To get the permissions that\n you need to use VPC Service Controls with Batch,\n\n ask your administrator to grant you the\n following IAM roles:\n\n - To configure a service perimeter: [Access Context Manager Editor](/iam/docs/roles-permissions/accesscontextmanager#accesscontextmanager.policyEditor) (`roles/accesscontextmanager.policyEditor`) on the project\n - To create a job:\n - [Batch Job Editor](/iam/docs/roles-permissions/batch#batch.jobsEditor) (`roles/batch.jobsEditor`) on the project\n - [Service Account User](/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the [job's service account](/batch/docs/create-run-job-custom-service-account#create-job-service-account), which by default is the [default Compute Engine service account](/compute/docs/access/service-accounts#default_service_account)\n - To identify the service perimeter for a project or network: [Access Context Manager Reader](/iam/docs/roles-permissions/accesscontextmanager#accesscontextmanager.policyReader) (`roles/accesscontextmanager.policyReader`) on the project\n - To identify the network and subnet for a job: [Compute Network Viewer](/iam/docs/roles-permissions/compute#compute.networkViewer) (`roles/compute.networkViewer`) on the project\n\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\n You might also be able to get\n the required permissions through [custom\n roles](/iam/docs/creating-custom-roles) or other [predefined\n roles](/iam/docs/roles-overview#predefined).\n3. If you create a job that runs in a service perimeter, you need to identify the network that you want to use for the job. The network you specify for a job that runs in a service perimeter must meet the following requirements:\n - The network is a [Virtual Private Cloud (VPC) network](/vpc/docs/vpc) that is in the same project as the job or is a [Shared VPC network](/vpc/docs/shared-vpc) that is hosted by or shared with the project for the job.\n - The network includes a [subnetwork (subnet)](/vpc/docs/subnets) in the location where you want to run the job.\n - The network is in the required service perimeter and uses Private Google Access to allow access to the domains for the APIs and services that your job uses. For more information, see [Configure a service perimeter for Batch](#configure-service-perimeter) in this document.\n\n For more information, see [Create\n and manage VPC networks](/vpc/docs/create-modify-vpc-networks).\n\n\u003cbr /\u003e\n\nConfigure a service perimeter for Batch\n---------------------------------------\n\nTo configure a service perimeter for Batch, do the following:\n\n1. Plan the configuration for your service perimeter. For an overview of the\n configuration stages for service perimeters, see VPC Service Controls\n documentation for\n [Service perimeter details and configuration](/vpc-service-controls/docs/service-perimeters).\n\n To use Batch, the service perimeter must meet the following\n requirements:\n - **Restricted services:** To secure Batch within a\n service perimeter, you must include the Google Cloud services that\n are required for your Batch jobs in that perimeter,\n such as the following services:\n\n - **Batch API** (`batch.googleapis.com`)\n - **Cloud Logging API** (`logging.googleapis.com`): Required if you want your jobs to write logs into Cloud Logging. (Recommended)\n - **Container Registry API** (`containerregistry.googleapis.com`): Required if you submit a job that uses any containers with an image from Container Registry.\n - **Artifact Registry API** (`artifactregistry.googleapis.com`): Required if you submit a job that uses any containers with an image from Artifact Registry.\n - **Filestore API** (`file.googleapis.com`): Required if your job uses a [Filestore file share](/batch/docs/create-run-job-storage#use-nfs).\n - **Cloud Storage API** (`storage.googleapis.com`): Required for some jobs that use a [Cloud Storage bucket](/batch/docs/create-run-job-storage#use-bucket). Required if you use an image for your Batch job that does not have the [Batch service agent](/batch/docs/get-started) pre-installed.\n\n To learn how to enable each of these services in your service perimeter, see\n [VPC accessible services](/vpc-service-controls/docs/vpc-accessible-services).\n | **Caution:** For your Batch jobs to be fully protected by the service perimeter, you must specify *all* services that you plan to use.\n\n For each service you include other than Batch, you also\n need to verify that your service perimeter meets the requirements listed\n for that service in the\n [VPC Service Controls supported products and limitations](/vpc-service-controls/docs/supported-products)\n documentation.\n - **VPC networks:** Each Batch job\n requires a VPC network, so your service perimeter must\n include a VPC network that Batch jobs\n can run on. To learn how to configure a VPC network that\n can run your Batch jobs inside a service perimeter, see\n the following documents:\n\n - For an overview of using VPC networks in a service perimeter, see [VPC networks management in service perimeters](/vpc-service-controls/docs/vpc-perimeters-management).\n - To learn how to use Private Google Access with VPC Service Controls to configure access to the Google Cloud services that are required for your Batch jobs, see [Set up private connectivity to Google APIs and services](/vpc-service-controls/docs/set-up-private-connectivity).\n - For more information about the networking requirements for Batch jobs, see [Job networking overview](/batch/docs/networking-overview).\n2. [Create a new service perimeter](/vpc-service-controls/docs/create-service-perimeters)\n or [update an existing service perimeter](/vpc-service-controls/docs/manage-service-perimeters#update)\n to meet these requirements.\n\nCreate a job that runs in a service perimeter\n---------------------------------------------\n\nWhen you create a job that runs in a service perimeter, you must also\nblock external access for all the VMs a job runs on and specify a network and\nsubnet that allow the job to access required APIs.\n\nTo create a job that runs in a service perimeter, follow the steps in the\ndocumentation for\n[Create a job that blocks external access for all VMs](/batch/docs/job-without-external-access)\nand specify a network that meets the\n[network requirements for a job that runs in a service perimeter](#network-requirements).\n\nWhat's next\n-----------\n\n- If you have issues creating or running a job, see [Troubleshooting](/batch/docs/troubleshooting).\n- Learn more about [networking](/batch/docs/networking-overview).\n- Learn more about [creating a job](/batch/docs/create-run-job).\n- Learn how to [view jobs and tasks](/batch/docs/view-jobs-tasks)."]]