Compute Engine
所有 API 与参考文档
向 Compute Engine 进行身份验证
使用 Terraform 预配 Compute Engine 资源
OS Config API
概览
v2
REST 资源
folders.locations.global.policyOrchestrators
folders.locations.operations
organizations.locations.global.policyOrchestrators
organizations.locations.operations
projects.locations.global.policyOrchestrators
projects.locations.operations
类型
ListPolicyOrchestratorsResponse
v2beta
REST 资源
folders.locations.global.policyOrchestrators
folders.locations.operations
organizations.locations.global.policyOrchestrators
organizations.locations.operations
projects.locations.global.policyOrchestrators
projects.locations.operations
类型
ListPolicyOrchestratorsResponse
v1alpha
REST 资源
projects.locations.instanceOSPoliciesCompliances
projects.locations.instances.inventories
projects.locations.instances.osPolicyAssignments.reports
projects.locations.instances.vulnerabilityReports
projects.locations.osPolicyAssignments
projects.locations.osPolicyAssignments.operations
类型
InventoryView OSPolicyAssignmentReport
License Manager API
概览
v1
REST 资源
projects.locations.configurations
projects.locations.instances
projects.locations.operations
projects.locations.products
Use the Compute Engine alpha API
Stay organized with collections
Save and categorize content based on your preferences.
This document explains how to enable your project to send HTTP requests to alpha
Compute Engine API URIs. If you're new to the Compute Engine API, then see
Prerequisites .
By default, your project can't send HTTP requests to the following alpha
Compute Engine API URI:
https://compute.googleapis.com/compute/alpha/...
Google Cloud manages access to alpha URIs for specific Compute Engine
features. You must first allow your organization, folder, or project to access
and use alpha features. After this step, you can view which features are
available, and then enable a project to send HTTP requests to their alpha URIs.
Use Compute Engine alpha features to test and develop with early-stage
features before they're available in
Preview .
Caution: Compute Engine alpha features are experimental. Using them
might result in breaking changes. For more information, see the
Pre-GA offering service terms .
Before you begin
You can only enable a project to send HTTP requests to an alpha URI if the
project is part of an organization. If not, then
migrate the project to an
organization .
If you haven't already, set up authentication .
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
To use the Terraform samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
Install the Google Cloud CLI.
Configure the gcloud CLI to use your federated identity.
For more information, see
Sign in to the gcloud CLI with your federated identity .
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider
(IdP), confirm that you have
signed in to the gcloud CLI with your federated identity .
For more information, see
Set up authentication for a local development environment .
Required roles
To get the permissions that
you need to enable or disable projects to send HTTP requests to alpha Compute Engine API URIs,
ask your administrator to grant you the
following IAM roles:
For more information about granting roles, see Manage access to projects, folders, and organizations .
These predefined roles contain
the permissions required to enable or disable projects to send HTTP requests to alpha Compute Engine API URIs. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to enable or disable projects to send HTTP requests to alpha Compute Engine API URIs:
To edit organization policies:
orgpolicy.policy.set
on the organization, folder, or project
To enable or disable access to an alpha Compute Engine API URI for a project:
compute.previewFeatures.update
on the project
To view available alpha features:
compute.previewFeatures.get
on the project
You might also be able to get
these permissions
with custom roles or
other predefined roles .
Allow access to alpha features
Configure the Block Compute Engine preview features (compute.managed.blockPreviewFeatures)
organization policy. By default, this policy blocks all preview features.
To allow access to alpha features, you must either explicitly allow specific features
(recommended) or disable the policy (optional).
Method 1: Explicitly allow specific features (Recommended)
To allow specific preview features while keeping the policy enforced, select one of the following options:
Console
In the Google Cloud console, go to the Organization policies page.
Go to Organization policies
If you haven't already, from the project picker, select the
organization, folder, or project where you want to edit the policy.
In the Name column, click
Block Compute Engine preview features . The
Policy details page appears.
Click edit Manage policy . The
Edit policy page appears.
In the Policy source section, select Override parent's policy .
In the Rules section, click Add rule , and then do the following:
In the Enforcement section, select On .
In the row containing the allowedPreviewFeatures parameter,
click edit Edit . The
Edit parameter values pane appears.
In the Value type section, select User-defined .
In the User-defined values section, enter the feature name (for example, alpha-api-access).
Click Save .
Click Set policy . Then, in the dialog that appears, click
Set policy again.
The policy change can take up to 15 minutes to propagate.
gcloud
To download the compute.managed.blockPreviewFeatures policy as a file
named policy.yaml, use the
gcloud org-policies describe command
with one of the following flags:
To configure the policy in your organization, include the
--organization flag:
gcloud org-policies describe compute.managed.blockPreviewFeatures --organization=ORGANIZATION_ID > policy.yaml
To configure the policy in your folder, include the --folder flag:
gcloud org-policies describe compute.managed.blockPreviewFeatures --folder=FOLDER_ID > policy.yaml
To configure the policy in your project, include the --project flag:
gcloud org-policies describe compute.managed.blockPreviewFeatures --project=PROJECT_ID > policy.yaml
Replace the following:
Open the policy.yaml file using a text editor. In the file, after the
rules field, configure it to enforce the policy and list the allowed features under the parameters field.
For example, if you're configuring the policy in your organization, your policy.yaml
entry is as follows:
name : organizations/ORGANIZATION_ID /policies/compute.managed.blockPreviewFeatures
spec :
rules :
- enforce : true
parameters :
allowedPreviewFeatures :
- alpha-api-access
Save the policy.yaml file, and then close the text editor.
To update the policy for your organization, folder, or project, use the
gcloud org-policies set-policy command :
gcloud org-policies set-policy policy.yaml
Method 2: Disable the policy (Optional)
If you want to allow access to all preview features without listing them individually, you can disable the policy.
Console
Follow steps 1-5 from Method 1.
In the Rules section, click Add rule , and in the Enforcement section, select Off .
Click Set policy . Then, in the dialog that appears, click
Set policy again.
gcloud
Download the policy as described in Method 1.
Open the policy.yaml file using a text editor. In the file, after the
rules field, add the enforce field set to false. For example, if
you're disabling the policy in your organization, your policy.yaml
entry is as follows:
name : organizations/ORGANIZATION_ID /policies/compute.managed.blockPreviewFeatures
spec :
rules :
- enforce : false
Save the policy.yaml file, and then close the text editor.
To update the policy for your organization, folder, or project, use the
gcloud org-policies set-policy command :
gcloud org-policies set-policy policy.yaml
Optional: To delete the policy.yaml file, do one of the following:
If you're using the Linux or macOS terminal, then use the following
command:
rm policy.yaml
If you're using the Windows terminal, then use the following
command:
del policy.yaml
The policy change can take up to 15 minutes to propagate.
For more information about managing organization policies, see
Using constraints
in the Resource Manager documentation.
Use alpha features in your project
After you allow your organization, folder, or project access to
Compute Engine alpha features, you can enable a project to use those
features by completing the following steps:
View available alpha features
Enable an alpha feature
Optional: View enabled alpha features
View available alpha features
To view which Compute Engine features are available in alpha, select one
of the following options:
Console In the Google Cloud console, go to the Preview features page.
Go to Preview features
In the table that appears, you can view a list of available alpha features.
gcloud To view the Compute Engine features available in alpha, use the
gcloud compute preview-features list command .
Execute the
following
command:
Linux, macOS, or Cloud Shell
gcloud compute preview-features list
Windows (PowerShell)
gcloud compute preview-features list
Windows (cmd.exe)
gcloud compute preview-features list
You should receive a response similar to the following:
NAME STATUS
alpha-feature-1 DISABLED
alpha-feature-2 DISABLED
REST To view the Compute Engine features available in alpha, make a GET
request to the
previewFeatures.list method .
Before using any of the request data,
make the following replacements:
PROJECT_ID : the ID of your project
HTTP method and URL:
GET https://compute./compute/projects/PROJECT_ID /global/previewFeatures
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Note:
The following command assumes that you have logged in to
the gcloud CLI with your user account by running
gcloud init
or
gcloud auth login
, or by using Cloud Shell ,
which automatically logs you into the gcloud CLI
.
You can check the currently active account by running
gcloud auth list .
Execute the following command:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://compute./compute/projects/PROJECT_ID /global/previewFeatures"
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://compute./compute/projects/PROJECT_ID /global/previewFeatures" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"previewFeatures": [
{
"activationStatus": "DISABLED",
"creationTimestamp": "2025-03-01T00:00:00Z",
"description": "Please see status.description for details.",
"id": "560966157",
"name": "alphaFeature1",
"status": {
"description": "Enables access to alpha APIs.",
"helpLink": "some-link",
"releaseStatus": {
"stage": "GA",
"updateDate": {
"day": 1,
"month": 3,
"year": 2025
}
}
}
},
...
]
}
Enable an alpha feature
To enable your project to send HTTP requests to the alpha URI of a
Compute Engine feature, select one of the following options:
Console
In the Google Cloud console, go to the Preview features page.
Go to Preview features
Click Enable next to the preview feature you want to enable. Then, in the dialog that appears, click Enable again.
gcloud To enable your project to send HTTP requests to the alpha URI of a
Compute Engine feature, use the
gcloud compute preview-features update command
with the --activation-status flag set to enabled.
Before using any of the command data below,
make the following replacements:
FEATURE_NAME : the name of the feature that you
want to start using.
Execute the
following
command:
Linux, macOS, or Cloud Shell
gcloud compute preview-features update FEATURE_NAME \
--activation-status= enabled \
--rollout-plan= fast-rollout
Windows (PowerShell)
gcloud compute preview-features update FEATURE_NAME `
--activation-status= enabled `
--rollout-plan= fast-rollout
Windows (cmd.exe)
gcloud compute preview-features update FEATURE_NAME ^
--activation-status= enabled ^
--rollout-plan= fast-rollout
You should receive a response similar to the following:
REST To enable your project to send HTTP requests to the alpha URI of a
Compute Engine feature, make a PATCH request to the
previewFeatures.update method .
Before using any of the request data,
make the following replacements:
PROJECT_ID : the ID of your project.
FEATURE_NAME : the name of the feature that you
want to start using.
HTTP method and URL:
PATCH https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME
Request JSON body:
{
"activationStatus": "ENABLED",
"rolloutOperation": {
"rolloutInput": {
"predefinedRolloutPlan": "ROLLOUT_PLAN_FAST_ROLLOUT"
}
}
}
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Note:
The following command assumes that you have logged in to
the gcloud CLI with your user account by running
gcloud init
or
gcloud auth login
, or by using Cloud Shell ,
which automatically logs you into the gcloud CLI
.
You can check the currently active account by running
gcloud auth list .
Save the request body in a file named request.json,
and execute the following command:
curl -X PATCH \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ -d @request.json \ "https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME "
PowerShell (Windows)
Save the request body in a file named request.json,
and execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method PATCH ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile request.json ` -Uri "https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"kind": "compute#operation",
"status": "DONE"
}
View enabled alpha features
To view a list of enabled Compute Engine alpha features in your project,
select one of the following options:
Console
In the Google Cloud console, go to the Preview features page.
Go to Preview features
In the table that appears, you can view the enabled features by
verifying whether a green check mark appears next to a feature name.
gcloud To view a list of enabled alpha features, use the
gcloud compute preview-features list command
with the --filter flag set to activationStatus=ENABLED.
Execute the
following
command:
Linux, macOS, or Cloud Shell
gcloud compute preview-features list --filter= activationStatus = ENABLED
Windows (PowerShell)
gcloud compute preview-features list --filter= activationStatus = ENABLED
Windows (cmd.exe)
gcloud compute preview-features list --filter= activationStatus = ENABLED
You should receive a response similar to the following:
NAME STATUS
alpha-feature-1 ENABLED
alpha-feature-2 ENABLED
REST To view a list of enabled alpha features, make a GET request to the
previewFeatures.list method .
In the request URL, set the filter query parameter to
items.activationStatus=ENABLED.
Before using any of the request data,
make the following replacements:
PROJECT_ID : the ID of your project
HTTP method and URL:
GET https://compute./compute/projects/PROJECT_ID /global/previewFeatures?filter=activationStatus=ENABLED
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Note:
The following command assumes that you have logged in to
the gcloud CLI with your user account by running
gcloud init
or
gcloud auth login
, or by using Cloud Shell ,
which automatically logs you into the gcloud CLI
.
You can check the currently active account by running
gcloud auth list .
Execute the following command:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://compute./compute/projects/PROJECT_ID /global/previewFeatures?filter=activationStatus=ENABLED"
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://compute./compute/projects/PROJECT_ID /global/previewFeatures?filter=activationStatus=ENABLED" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"etag": "Ehx4OkkYX3CUXGRWAE8lvEn0ZDE=/rEhZfPEilwjblfZuwOYpO1nHC2c=",
"id": "projects/example-project",
"previewFeatures": [
{
"activationStatus": "ENABLED",
"creationTimestamp": "2025-03-01T00:00:00Z",
"description": "Please see status.description for details.",
"id": "560966157",
"name": "alphaFeature1",
"status": {
"description": "Enables access to alpha APIs.",
"helpLink": "some-link",
"releaseStatus": {
"stage": "GA",
"updateDate": {
"day": 1,
"month": 3,
"year": 2025
}
}
}
},
...
],
"selfLink": "https://www./compute/projects/example-project"
}
Disable an alpha feature
If you no longer need to use a Compute Engine alpha feature, then you
can disable your project access to it.
To disable your project from sending HTTP requests to the alpha URI of a
Compute Engine feature, select one of the following options:
Console
In the Google Cloud console, go to the Preview features page.
Go to Preview features
Click Disable next to the preview feature you want to disable. Then, in the dialog that appears, click
Disable again.
gcloud To disable your project from sending HTTP requests to the alpha URI of a
Compute Engine feature, use the
gcloud compute preview-features update command
with the --activation-status flag set to unspecified.
Before using any of the command data below,
make the following replacements:
FEATURE_NAME : the name of the feature that you
want to stop using.
Execute the
following
command:
Linux, macOS, or Cloud Shell
gcloud compute preview-features update FEATURE_NAME \
--activation-status= unspecified \
--rollout-plan= fast-rollout
Windows (PowerShell)
gcloud compute preview-features update FEATURE_NAME `
--activation-status= unspecified `
--rollout-plan= fast-rollout
Windows (cmd.exe)
gcloud compute preview-features update FEATURE_NAME ^
--activation-status= unspecified ^
--rollout-plan= fast-rollout
You should receive a response similar to the following:
REST To disable your project from sending HTTP requests to the alpha URI of a
Compute Engine feature, make a PATCH request to the
previewFeatures.update method .
Before using any of the request data,
make the following replacements:
PROJECT_ID : the ID of your project.
FEATURE_NAME : the name of the feature that you
want to stop using.
HTTP method and URL:
PATCH https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME
Request JSON body:
{
"activationStatus": "ACTIVATION_STATUS_UNSPECIFIED",
"rolloutOperation": {
"rolloutInput": {
"predefinedRolloutPlan": "ROLLOUT_PLAN_FAST_ROLLOUT"
}
}
}
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Note:
The following command assumes that you have logged in to
the gcloud CLI with your user account by running
gcloud init
or
gcloud auth login
, or by using Cloud Shell ,
which automatically logs you into the gcloud CLI
.
You can check the currently active account by running
gcloud auth list .
Save the request body in a file named request.json,
and execute the following command:
curl -X PATCH \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ -d @request.json \ "https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME "
PowerShell (Windows)
Save the request body in a file named request.json,
and execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method PATCH ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile request.json ` -Uri "https://compute./compute/projects/PROJECT_ID /global/previewFeatures/FEATURE_NAME " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{
"kind": "compute#operation",
"status": "DONE"
}
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-08-05 UTC.
[null,null,["Last updated 2026-08-05 UTC."],[],[]]