[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[],[],null,["# Share a Cloud TPU reservation\n=============================\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis document describes how to enable reservation sharing. Reservation sharing\nlets you create TPU VMs in one project (a consumer project) and use a\nreservation that another project (the owner project) owns. Reservation sharing\nalso lets you run custom training or prediction jobs in Vertex AI using\na TPU reservation.\n\nThe *owner project* is the project where you created the reservation. *Consumer\nprojects* are one or more projects that share the reservation. You can create\nTPU VMs in the owner project and consumer projects using the reservation in the\nowner project.\n\nFor more information about obtaining a TPU reservation, see [About Cloud TPU\nreservations](/tpu/docs/about-tpu-reservations).\n| **Note:** Reservation sharing is supported on v4 and later [TPU\n| versions](/tpu/docs/system-architecture-tpu-vm#versions).\n\nLimitations\n-----------\n\nBefore you share a TPU reservation, consider the following:\n\n- You can modify a shared reservation only from its owner project.\n\n- You can modify a short-term reservation in calendar mode or long-term\n reservation only as follows:\n\n - You can modify the reservation only after its start time.\n\n - You can modify the reservation only to allow or disallow jobs in\n Vertex AI from consuming it.\n\nShare a Cloud TPU reservation\n-----------------------------\n\nThe following sections describe the different methods to share a reservation.\n\n### Enable sharing of a TPU reservation\n\nYou can create TPU VMs in a consumer project using a reservation that another\nproject owns. All projects that share a TPU reservation must be part of the same\n[organization](/resource-manager/docs/creating-managing-organization#viewing_projects_in_an_organization_resource).\n\nTo enable sharing of a TPU reservation:\n\n1. Grant permission to the owner project to create and modify shared\n reservations using the [`gcloud resource-manager org-policies allow`\n command](/sdk/gcloud/reference/resource-manager/org-policies/allow):\n\n ```bash\n gcloud resource-manager org-policies allow \\\n compute.sharedReservationsOwnerProjects \\\n projects/OWNER_PROJECT_NUMBER --organization=ORGANIZATION_ID\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eOWNER_PROJECT_NUMBER\u003c/var\u003e: The [project number](/resource-manager/docs/creating-managing-projects#identifying_projects) (not project ID) of a project in your organization that you want to allow to create and modify shared reservations.\n - \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e: The [organization resource ID](/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id) of your organization.\n2. Enable CUD sharing through the Google Cloud console. For instructions, see\n [Enable CUD sharing for resource-based\n commitments](/compute/docs/committed-use-discounts/share-resource-cuds-across-projects#turning_on_committed_use_discount_sharing).\n\n | **Note:** It can take up to 24 hours for a new CUD sharing commitment scope to take effect.\n3. To enable sharing, use the [`gcloud beta compute reservations\n update` command](/sdk/gcloud/reference/beta/compute/reservations/update)\n with the `--share-setting=projects` and `--share-with` flags:\n\n ```bash\n gcloud beta compute reservations update RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --share-setting=projects \\\n --share-with=CONSUMER_PROJECT_IDS \\\n --zone=ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n - \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n - \u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_IDS\u003c/var\u003e: A comma-separated list of IDs of projects that can consume this reservation. For example, `project-1,project-2`. You can include up to 100 consumer projects. These projects must be in the same organization as the owner project. Don't include the owner project. By default, the owner project is already allowed to consume the reservation.\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone where the reservation is located.\n\n### Disable sharing of a TPU reservation\n\nTo disable sharing a TPU reservation with a list of consumer projects, use the\n[`gcloud beta compute reservations\nupdate` command](/sdk/gcloud/reference/beta/compute/reservations/update) with\nthe `--share-setting=projects` and `--remove-share-with` flags: \n\n```bash\ngcloud compute reservations update RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --share-setting=projects \\\n --remove-share-with=CONSUMER_PROJECT_IDS \\\n --zone=ZONE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n- \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n- \u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_IDS\u003c/var\u003e: A comma-separated list of IDs of projects that you want to stop sharing the reservation with. For example, `project-1,project-2`.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone where the reservation is located.\n\nTo disable sharing a TPU reservation with all consumer projects, change the\nreservation to a local reservation using the [`gcloud beta compute reservations\nupdate` command](/sdk/gcloud/reference/beta/compute/reservations/update) with\nthe `--share-setting=local` flag: \n\n```bash\ngcloud beta compute reservations update RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --share-setting=local \\\n --zone=ZONE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n- \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone where the reservation is located.\n\n### Allow Vertex AI to use a TPU reservation\n\nYou can allow [training](/vertex-ai/docs/training/use-reservations) or\n[prediction jobs](/vertex-ai/docs/predictions/use-reservations) in\nVertex AI to consume a short-term reservation in calendar mode or\nlong-term reservation only after its start time.\n\nTo allow Vertex AI to consume a TPU reservation, use the\n[`gcloud beta compute\nreservations update`\ncommand](/sdk/gcloud/reference/beta/compute/reservations/update) with the\n`--reservation-sharing-policy=ALLOW_ALL` flag: \n\n```bash\ngcloud beta compute reservations update RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --zone=ZONE \\\n --reservation-sharing-policy=ALLOW_ALL\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n- \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone of the reservation.\n\n### Disallow Vertex AI to use a TPU reservation\n\nBefore you disallow Vertex AI from consuming a TPU reservation,\nstop any Vertex AI jobs that use it. Otherwise, you encounter\nerrors.\n\nTo disallow Vertex AI from consuming a TPU reservation, use the\n[`gcloud beta compute reservations\nupdate`](/sdk/gcloud/reference/beta/compute/reservations/update) command with\nthe `--reservation-sharing-policy=DISALLOW_ALL` flag: \n\n```bash\ngcloud beta compute reservations update RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --zone=ZONE \\\n --reservation-sharing-policy=DISALLOW_ALL\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n- \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone of the reservation.\n\nGet information about a shared reservation\n------------------------------------------\n\nYou can get information about a shared reservation only from its owner project.\n\nTo get information about a shared reservation, use the [`gcloud compute\nreservations describe`\ncommand](/sdk/gcloud/reference/compute/reservations/describe): \n\n```bash\ngcloud compute reservations describe RESERVATION_NAME \\\n --project=OWNER_PROJECT_ID \\\n --zone=ZONE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESERVATION_NAME\u003c/var\u003e: The name of the reservation.\n- \u003cvar translate=\"no\"\u003eOWNER_PROJECT_ID\u003c/var\u003e: The ID of the project that contains the reservation.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: The zone of the reservation.\n\nThe response is similar to the following: \n\n```bash\naggregateReservation:\n[...]\nname: RESERVATION_NAME\nreservationSharingPolicy:\n serviceShareType: ALLOW_ALL\nresourceStatus: {}\nselfLink: https://www.googleapis.com/compute/v1/projects/OWNER_PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME\nshareSettings:\n projectMap:\n '\u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_1\u003c/var\u003e':\n projectId: '\u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_1\u003c/var\u003e'\n '\u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_2\u003c/var\u003e':\n projectId: '\u003cvar translate=\"no\"\u003eCONSUMER_PROJECT_2\u003c/var\u003e'\n shareType: SPECIFIC_PROJECTS\nspecificReservationRequired: true\nstatus: READY\nzone: https://www.googleapis.com/compute/v1/projects/OWNER_PROJECT_ID/zones/ZONE\n```\n\nWhat's next\n-----------\n\n- [Learn about Cloud TPU reservations](/tpu/docs/about-tpu-reservations)\n- [Consume your reservation](/tpu/docs/consume-reservation)\n- [Manage your TPUs](/tpu/docs/managing-tpus-tpu-vm)"]]