Create a VMware Engine network

VMware Engine networks handle connections to and from private clouds according to a network policy that you define separately.

Before you begin

Google Cloud CLI and API requirements

To use the gcloud command line tool or the API to manage your VMware Engine resources, we recommend configuring the tools as described below.

gcloud

  1. Set your default project ID:

    gcloud config set project PROJECT_ID
    
  2. Set a default region and/or zone:

    gcloud config set compute/region REGION
    gcloud config set compute/zone ZONE

For more information on the gcloud vmware tool, reviewing the Cloud SDK reference docs.

API

API examples in this documentation set use the cURL command-line tool to query the API. A valid access token is required as part of the cURL request. There are many ways to get a valid access token; the following steps use the gcloud tool to generate a access token:

  1. Login to Google Cloud

    gcloud auth login
    
  2. Generate access token and export to TOKEN

    export TOKEN=`gcloud auth print-access-token`
    
  3. Verify that TOKEN is set properly

    echo $TOKEN
    
    Output:
    TOKEN
    

Now, use the authorization token in your requests to the API. For example:

curl -X GET -H "Authorization: Bearer \"$TOKEN\""  -H "Content-Type: application/json; charset=utf-8" https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations

Python

Python code samples in this documentation use the VMware Engine library to communicate with the API. To be able to use this approach, the library needs to be installed and the Application Default Credentials should be configured.

  1. Download and install the Python library

     pip install google-cloud-vmwareengine
    
  2. Configure the ADC information by executing those command in your shell

      gcloud auth application-default login
    

    or use a Service Account key file

      export GOOGLE_APPLICATION_CREDENTIALS="FILE_PATH"
    

For more information about the library, visit the reference page or view code samples on GitHub.

Create a VMware Engine network

Create a VMware Engine network using the gcloud CLI or VMware Engine API:

gcloud

To create a VMware Engine network using the gcloud CLI:

  1. Run gcloud vmware networks create command:

    gcloud vmware networks create NETWORK_ID \
      --type=STANDARD \
      --description="DESCRIPTION"

    Replace the following:

    • NETWORK_ID: the network name for this request
    • DESCRIPTION: a description for this network
  2. Optional: If you want to list all VMware Engine networks to confirm the creation of the new network, use the gcloud vmware networks list command:

    gcloud vmware networks list \
      --location=global

API

To create a VMware Engine network using the VMware Engine API, do the following:

  1. To create a VMware Engine network, make a POST request:

    POST "https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations/global/vmwareEngineNetworks?vmware_engine_network_id=NETWORKD_ID"
    
    '{
      "type": "standard",
      "description": "DESCRIPTION"
    }'

    Replace the following:

    • PROJECT_ID: the project ID for this request.
    • NETWORK_ID: the network name for this request.
    • DESCRIPTION: a description for this network.
  2. Optional: To list all VMware Engine networks to confirm the creation of the new network, make a GET request. Replace PROJECT_ID with the project ID for this request.

    GET https://vmwareengine.googleapis.com/v1/projects//locations/global/vmwareEngineNetworks

Update a VMware Engine network

Update a VMware Engine network using the gcloud CLI or VMware Engine API:

gcloud

To update a VMware Engine network using the gcloud CLI, do the following:

  1. Update the description of a VMware Engine network by running the gcloud vmware networks update command:

    gcloud vmware networks update NETWORK_ID \
      --description='DESCRIPTION'

    Replace the following:

    • NETWORK_ID: the network name for this request.
    • DESCRIPTION: an updated description for this network.
  2. Optional: If you want to view the updated attribute, use the gcloud vmware networks describe command:

    gcloud vmware networks describe NETWORK_ID

    Replace NETWORK_ID with the network name for this request.

API

To update a VMware Engine network using the VMware Engine API, do the following:

  1. To update the description of a VMware Engine network, make a PATCH request:

    PATCH "https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/vmwareEngineNetworks/NETWORK_ID?update_mask=description"
    
    '{
      "description":"DESCRIPTION"
    }'
    

    Replace the following:

    • PROJECT_ID: the project for this request
    • LOCATION: the location of the network, either global for legacy networks or the region for standard networks
    • NETWORK_ID: the network name for this request
    • DESCRIPTION: an updated description for this network
  2. Optional: If you want to view the updated attribute, make a GET request:

    GET "https://vmwareengine.googleapis.com/v1/projects/PROJECT_ID/locations/global/vmwareEngineNetworks/NETWORK_ID"

What's next