> ## Documentation Index
> Fetch the complete documentation index at: https://docs.megaport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating a VXC between a Port and Google Cloud with the API

> This help topic describes how to use the Megaport API to create a VXC to Google Cloud.

This topic describes the API procedure to create a VXC from a Port to Google Cloud, including how to look up Google Cloud port locations and order the VXC.

Before you begin, obtain a valid access token. For more information, see [Creating an API Key](/api/api-key).

## Look up Google pairing key

A connection between a Port and Google Cloud requires a pairing key. You get this key from the Google Cloud portal. You use the API to validate a Google Cloud pairing key and the response includes details of the associated ports and peers. You need the port details to create the VXC.

**To look up the pairing key in the Postman collection**

1. In Postman, expand **Cloud Connectivity > Port > Google Cloud** in the left navigation and select **GET Look Up Google Pairing Key**.

2. Add the pairing key to the endpoint.

3. Click **Send** to make a GET request to the API server.

   ```http theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   GET {baseUrl}/v2/secure/google/{pairing_key}
   ```

Here is a sample response for a pairing key with the first VXC configured but the second VXC available (vxc = null):

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
   "message": "Successful lookup",
    "data": {
        "bandwidths": [
        50,
        100,
        200,
        300,
        400,
        500,
        1000,
        2000,
        5000,
        10000
        ],
        "megaports": [
        {
            "port": 13687,
            "vxc": {
                // existing vxc object
            },
            "productId": 13687,
            "productUid": "2c9337ba-b6a6-44cc-851c-58315060a0e3",
            "name": "New York (lga-zone2-1422)",
            "nServiceId": 30890,
            "description": "Google Inc at Digital Realty NYC1",
            "companyId": 90,
            "companyUid": "29ba879b-45c8-48eb-bd97-618d0f20ea04",
            "companyName": "Google Inc",
            "portSpeed": 10000,
            "locationId": 62,
            "state": "NY",
            "country": "USA"
        },
        {
            "port": 12515,
            "vxc": null,
            "productId": 12515,
            "productUid": "2fa8c6c5-314f-4d14-8fb6-e1f7f86bdacc",
            "name": "Ashburn (iad-zone2-1)",
            "nServiceId": 28349,
            "description": "Google Inc at zColo 21635 Red Rum Drive",
            "companyId": 90,
            "companyUid": "29ba879b-45c8-48eb-bd97-618d0f20ea04",
            "companyName": "Google Inc",
            "portSpeed": 10000,
            "locationId": 84,
            "state": "VA",
            "country": "USA"
        }
        ],
        "resource_type": "csp_connection"
    }
}
```

## Create and deploy a VXC

With the details from the pairing key, create a VXC to the available port.

**To create a VXC**

1. Select **POST Create VXC to Google Cloud (v3)**.

   <Tip>
     To test your request before you order and see pricing details, you can use:
     `POST {baseUrl}/v3/networkdesign/validate`
   </Tip>

2. Update the Body of the request with the `productUid` of the Port, the name of the VXC, the `productUid` of the Google Cloud port, and the pairing key. The bandwidth options are defined in the list returned by the pairing key and you must use a predefined bandwidth.

3. Click **Send** to post the request.

   ```http theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   POST {baseUrl}/v3/networkdesign/buy
   ```

```json {3,10,15,18} theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
[
    {
        "productUid": "d5f4a3c6-06d3-4cfa-9d4e-8ce6ec0b6dbd", //UID of your Megaport (A-End)
        "associatedVxcs": [
            {
                "rateLimit": 100, // from list of supported bandwidths in key lookup
                "term":12,
                "shutdown": false,
                "promoCode": "promox3mnthfree2",
                "productName": "Example Google VXC",
                "aEnd": {
                    "vlan": 90,
                },
                "bEnd": {
                    "productUid": "7bab4547-ff88-43f9-a1de-3df637522fa5", // port UID from pairing key lookup
                    "partnerConfig": {
                        "connectType": "GOOGLE",
                        "pairingKey": "fbbf41b1-9513-4837-a91a-22a8bb065704/us-west1/2"
                    }
                },
                "productType": "VXC"
            }
        ]
    }
]
```

Once you have completed and deployed the VXC, go back to the Google Cloud Console and accept the attachment. You will be provided your private IP address from Google to configure BGP.

This completes your Layer 2 VXC deployment.
