> ## 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 an MVE and AWS with the API

> This help topic describes how to use the Megaport API to create a VXC between a Megaport Virtual Edge (MVE) and AWS Direct Connect.

This topic describes the API procedure to create a VXC from an MVE to AWS, including how to look up AWS locations and order VXCs on specific vNICs.

You can set up two types of AWS connections to an MVE: an AWS Hosted VIF and an AWS Hosted Connection.

You can distinguish the type of connection supported by partner locations using the connectType parameter. Hosted VIF connections are connectType=AWS and Hosted Connections are connectType=AWSHC.

The MVE to AWS deployment includes these tasks:

1. **Look up AWS location details**

   To create a VXC to AWS, you first need to identify the `productUid` of the port you want to connect to.

   You can look up AWS locations for the B-End of the connection with the `v2/dropdowns/partner/megaports` endpoint.

2. **Create and deploy a VXC**

   With the port details identified, you can create the VXC to AWS from the MVE.

   Configuration details are specified in the Body of the request. Some of the key information you need to specify include the `productUid` of the MVE, the `productUid` of the AWS port, and the AWS account ID.

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

## Look up AWS location details

Use the API to look up the `productUid` of the port you want to connect to. The response includes details of the available ports. You need the port details to create the VXC.

In the API response, available ports that accept VXCs are listed as `"vxcPermitted": true`.

**To look up AWS location details**

1. Expand the **Locations** folder in the left navigation and click **GET Partner Megaports**.

2. 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/dropdowns/partner/megaports
   ```

   This request returns all the interfaces Megaport has with Cloud Service Providers. You can search by clicking the magnifying glass and entering a location, data center, or other parameter in the search field.

   The connectType indicates the Cloud Service Provider. AWS includes "AWS" for Hosted VIFs and "AWSHC" for Hosted Connections.

   You can filter the results by `connectType` and `vxcPermitted`.

   ```http theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   GET {baseUrl}/v2/dropdowns/partner/megaports?connectType=AWS&vxcPermitted=true
   ```

   This example uses a port in the region eu-west-2 (London) that accepts VXCs (`"vxcPermitted": true`).

```json {2,5,9} theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
      {
           "productUid": "b9dcbdca-b73a-4fc9-9ac9-98cecde81ba2",
           "companyUid": "605cb850-dfb4-4a05-a171-8bf17757b3a2",
           "companyName": "AWS",
           "title": "EU (London) (eu-west-2)",
           "locationId": 90,
           "speed": 10000,
           "maxVxcSpeed": 10000,
           "vxcPermitted": true,
           "diversityZone": null,
           "rank": 378,
           "lag_id": null,
           "lag_primary": false,
           "aggregation_id": null,
           "connectType": "AWS"
      },
```

## Create and deploy a VXC Hosted VIF

With the port details, create the VXC to AWS from the MVE.

You specify the configuration details in the Body of the request. The first `productUid` identifies the MVE ID and the `bEnd: productUid` identifies the AWS port location from the Partner Megaports lookup. You also need to provide your AWS account number in the request.

This example uses the Hosted VIF connection type, connectType=AWS.

<Tip>
  To test your request before you order and see pricing details, use the `/v3/networkdesign/validate` endpoint with the same Body configuration.
</Tip>

**To create a VXC**

1. Create a request with the **POST Buy AWS - Hosted VIF (v3)** endpoint:

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

2. Update the Body of the request with the `productUid` of the MVE, the name of the VXC, the `productUid` of the AWS port, and the AWS account ID (`ownerAccount`).\
   You can also change additional values, such as rate limit, contract term, VLAN ID, ASN values, authKey, and IP addressing. The vNIC is determined by `vNicIndex`, innerVlan identifies VLAN number run within the vNIC, in this case 103.

<Note>
  The vNIC number relates to the following MVE interfaces:

  * vNIC 0 = interface 1 on the MVE
  * vNIC 1 = interface 2 on the MVE
  * vNIC 2 = interface 3 on the MVE
  * vNIC 3 = interface 4 on the MVE
  * vNIC 4 = interface 5 on the MVE
</Note>

Here is a sample request:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
[
 {
   "productUid": "{ mveid }",
   "associatedVxcs": [
     {
       "productName": "Test AWS VIF MVE VXC",
       "rateLimit": "100",
       "term": 12,
       "shutdown": false,
       "promoCode": "promox3mnthfree2",
       "aEnd": {
       "vNicIndex":2,
       "vlan": null,
         "innerVlan": 103
       },
       "bEnd": {
         "productUid": "{ awsPortUid }",
         "partnerConfig": {
           "connectType": "AWS",
           "Name": "Test Megaport",
           "type": "private",
           "asn": 65105,
           "ownerAccount": "XXXXXXXXXXXX",
           "authKey": "123455",
           "customerIpAddress": null,
           "amazonIpAddress": null
         }
       }
     }
   ]
 }
]

```

After sending the request, you will receive a successful response when the VXC has been ordered.

Here is a sample response:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
    "message": "VXC [0d22feee-8d06-4041-98be-5b827c33c78a] created.",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
       {
           "createDate": 1709811450016,
           "vxcOrderId": 139933,
           "payerMegaPortId": 190079,
           "nonPayerMegaPortId": 6199,
           "payerMegaPortName": "MVE for VNIC config",
           "nonPayerMegaPortName": "EU (London) (eu-west-2)",
           "payerCompanyId": 1153,
           "nonPayerCompanyId": 117,
           "payerLocationId": 89,
           "nonPayerLocationId": 89,
           "salesId": null,
           "payerCompanyName": "Megaport Lab",
           "nonPayerCompanyName": "AWS",
           "payerMegaPortNsId": 510708,
           "nonPayerMegaPortNsId": 13055,
           "payerVlanId": 0,
           "nonPayerVlanId": 0,
           "payerInnerVlanId": 103,
           "nonPayerInnerVlanId": null,
           "payerApproverName": "name",
           "payerApproverId": number,
           "nonPayerApproverName": "name",
           "nonPayerApproverId": number,
           "payerApproval": number,
           "nonPayerApproval":number,
           "fixedTerm": true,
           "duration": 1,
           "rollover": true,
           "serviceName": "from MVE for VNIC config to EU (London) (eu-west-2)",
           "payerStatus": "APPROVED",
           "nonPayerStatus": "APPROVED",
           "speed": 100,
           "distanceBand": "METRO",
           "intercapPath": "",
           "awsId": null,
           "promoCode": null,
           "rateType": "MONTHLY",
           "vxcJTechnicalServiceId": 190085,
           "vxcJTechnicalServiceUid": "0d22feee-8d06-4041-98be-5b827c33c78a",
           "provisionDate": 1709811449985,
           "orderType": "NEW",
           "monthlyDiscountAmount": null,
           "discountMonths": null,
           "amazonDirectConnectConfigDto": {
               "type": "private",
               "asn": 65105,
               "ownerAccount": "aws account ID",
               "authKey": "123455",
               "customerIpAddress": null,
               "amazonIpAddress": null,
               "prefixes": null,
               "name": null
           },
           "amsixConnectConfigDto": null,
           "sdrcProvItem": null,
           "rate": null,
           "setup": null,
           "asn": null,
           "bgpPassword": null,
           "usageAlgorithm": "POST_PAID_HOURLY_SPEED_METRO_VXC",
           "costCentre": null,
           "azureServiceKey": null,
           "oracleVirtualCircuitId": null,
           "serviceKey": null,
           "vxc": {
               "serviceName": "Test AWS VIF MVE VXC",
               "name": "Test AWS VIF MVE VXC",
               "secondaryName": null,
               "technicalServiceId": 190085,
               "technicalServiceUid": "0d22feee-8d06-4041-98be-5b827c33c78a",
               "requestedDate": 1709811449985,
               "configuredDate": null,
               "currentEstimatedDelivery": null,
               "companyName": "Megaport Lab",
               "companyId": 1153,
               "billingContactName": null,
               "billingContactId": null,
               "adminContactName": null,
               "adminContactId": null,
               "technicalContactName": null,
               "technicalContactId": null,
               "salesName": null,
               "salesId": null,
               "billableId": 181633,
               "billableUsageAlgorithm": null,
               "productType": "VXC",
               "provisioningStatus": "DEPLOYABLE",
               "failedReason": null,
               "inAdvanceBillingStatus": null,
               "provisioningItems": [],
               "tags": [],
               "vxcDistanceBand": "METRO",
               "intercapPath": "",
               "marketplaceVisibility": true,
               "vxcPermitted": true,
               "vxcAutoApproval": false,
               "createDate": 1709811450003,
               "terminationDate": null,
               "contractStartDate": null,
               "contractTermMonths": 1,
               "rateType": "MONTHLY",
               "trialAgreement": false,
               "payerCompanyId": null,
               "nonPayerCompanyId": null,
               "minimumSpeed": null,
               "maximumSpeed": null,
               "rateLimit": 100,
               "errorMessage": null,
               "lagId": null,
               "aggregationId": null,
               "lagPrimary": null,
               "market": "UK",
               "accountManager": null,
               "promptUid": null,
               "components": [],
               "attributes": [],
               "aLocation": null,
               "bLocation": null,
               "aMetro": null,
               "aCountry": null,
               "aLocationId": null,
               "bLocationId": null,
               "bMetro": null,
               "bCountry": null,
               "attributeTags": {},
               "createdBy": "b0dedbd2-ecc7-4bad-a13b-6c34b4005115",
               "buyoutPort": null,
               "virtual": false,
               "locked": false,
               "adminLocked": false,
               "bgpShutdownDefault": false
           },
           "connectType": "AWS",
           "payerConfig": {},
           "nonPayerConfig": {},
           "attributeTags": {},
           "serviceLicense": null,
           "fullyApproved": true
       }
   ]
}

```

The VXC will now appear in the Megaport Portal.

For this example, the AWS Hosted VIF will appear in the AWS portal account under Direct Connect - Virtual Interfaces. The account holder can accept the Virtual Interface and connect it to a Virtual Private Gateway or a Direct Connect Gateway and then to their VPCs.

## Create and deploy a VXC Hosted Connection

With the port details, create the VXC to AWS from the MVE.

You specify the configuration details in the Body of the request. The first `productUid` identifies the MVE ID and the `bEnd: productUid` identifies the AWS port location from the Partner Megaports lookup. You also need to provide your AWS account number in the request.

This example uses the Hosted Connection connection type, connectType=AWSHC.

<Tip>
  To test your request before you order and see pricing details, use the `/v3/networkdesign/validate` endpoint with the same Body configuration.
</Tip>

**To create a VXC**

1. Create a request with the **POST Buy AWS - Hosted Connection (v3)** endpoint:

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

2. Update the Body of the request with the `productUid` of the MVE, the name of the VXC, the `productUid` of the AWS port, and the AWS account ID (`ownerAccount`).\
   You can also change additional values, such as rate limit, contract term, VLAN ID, ASN values, authKey, and IP addressing. The vNIC is determined by `vNicIndex`, innerVlan identifies VLAN number run within the vNIC, in this case 666.

<Note>
  The vNIC number relates to the following MVE interfaces:

  * vNIC 0 = interface 1 on the MVE
  * vNIC 1 = interface 2 on the MVE
  * vNIC 2 = interface 3 on the MVE
  * vNIC 3 = interface 4 on the MVE
  * vNIC 4 = interface 5 on the MVE
</Note>

Here is a sample request:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
[
 {
   "productUid": "{ mveid }",
   "associatedVxcs": [
     {
       "productName": "Test AWS over Vnic2",
       "rateLimit": 100,
       "term": 12,
       "shutdown": false,
       "promoCode": "promox3mnthfree2",
       "aEnd": {
           "vNicIndex":2,
           "vlan":null,
           "innerVlan":666
       },
       "bEnd": {
         "productUid": "{ awshcPortUid }",
         "partnerConfig": {
           "connectType":"AWSHC",
           "ownerAccount": "XXXXXXXXXXXX",
           "name": "AWS link MVE link 2"
           }
          }
        }
     ]
   }
]

```

After sending the request, you will receive a successful response when the VXC has been ordered.

Here is a sample response:

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
    "message": "VXC [5668c467-17eb-47e3-beba-87b9e7784a17] created.",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
       {
           "createDate": 1709812459883,
           "vxcOrderId": 139936,
           "payerMegaPortId": 190079,
           "nonPayerMegaPortId": 114147,
           "payerMegaPortName": "MVE for VNIC config",
           "nonPayerMegaPortName": "EU (London) (eu-west-2)",
           "payerCompanyId": 1153,
           "nonPayerCompanyId": 117,
           "payerLocationId": 89,
           "nonPayerLocationId": 90,
           "salesId": null,
           "payerCompanyName": "Megaport Lab",
           "nonPayerCompanyName": "AWS",
           "payerMegaPortNsId": 510708,
           "nonPayerMegaPortNsId": 271398,
           "payerVlanId": 0,
           "nonPayerVlanId": 0,
           "payerInnerVlanId": 666,
           "nonPayerInnerVlanId": null,
           "payerApproverName": "David Sloan",
           "payerApproverId": 41315,
           "nonPayerApproverName": "David Sloan",
           "nonPayerApproverId": 41315,
           "payerApproval": number,
           "nonPayerApproval": number,
           "fixedTerm": true,
           "duration": 1,
           "rollover": true,
           "serviceName": "from MVE for VNIC config to EU (London) (eu-west-2)",
           "payerStatus": "APPROVED",
           "nonPayerStatus": "APPROVED",
           "speed": 100,
           "distanceBand": "METRO",
           "intercapPath": "",
           "awsId": null,
           "promoCode": null,
           "rateType": "MONTHLY",
           "vxcJTechnicalServiceId": 190089,
           "vxcJTechnicalServiceUid": "5668c467-17eb-47e3-beba-87b9e7784a17",
           "provisionDate": 1709812459853,
           "orderType": "NEW",
           "monthlyDiscountAmount": null,
           "discountMonths": null,
           "amazonDirectConnectConfigDto": null,
           "amsixConnectConfigDto": null,
           "sdrcProvItem": null,
           "rate": null,
           "setup": null,
           "asn": null,
           "bgpPassword": null,
           "usageAlgorithm": "POST_PAID_HOURLY_SPEED_METRO_VXC",
           "costCentre": null,
           "azureServiceKey": null,
           "oracleVirtualCircuitId": null,
           "serviceKey": null,
           "vxc": {
               "serviceName": "Test AWS over Vnic2",
               "name": "Test AWS over Vnic2",
               "secondaryName": null,
               "technicalServiceId": 190089,
               "technicalServiceUid": "5668c467-17eb-47e3-beba-87b9e7784a17",
               "requestedDate": 1709812459853,
               "configuredDate": null,
               "currentEstimatedDelivery": null,
               "companyName": "Megaport Lab",
               "companyId": 1153,
               "billingContactName": null,
               "billingContactId": null,
               "adminContactName": null,
               "adminContactId": null,
               "technicalContactName": null,
               "technicalContactId": null,
               "salesName": null,
               "salesId": null,
               "billableId": 181637,
               "billableUsageAlgorithm": null,
               "productType": "VXC",
               "provisioningStatus": "DEPLOYABLE",
               "failedReason": null,
               "inAdvanceBillingStatus": null,
               "provisioningItems": [],
               "tags": [],
               "vxcDistanceBand": "METRO",
               "intercapPath": "",
               "marketplaceVisibility": true,
               "vxcPermitted": true,
               "vxcAutoApproval": false,
               "createDate": 1709812459869,
               "terminationDate": null,
               "contractStartDate": null,
               "contractTermMonths": 1,
               "rateType": "MONTHLY",
               "trialAgreement": false,
               "payerCompanyId": null,
               "nonPayerCompanyId": null,
               "minimumSpeed": null,
               "maximumSpeed": null,
               "rateLimit": 100,
               "errorMessage": null,
               "lagId": null,
               "aggregationId": null,
               "lagPrimary": null,
               "market": "UK",
               "accountManager": null,
               "promptUid": null,
               "components": [],
               "attributes": [],
               "aLocation": null,
               "bLocation": null,
               "aMetro": null,
               "aCountry": null,
               "aLocationId": null,
               "bLocationId": null,
               "bMetro": null,
               "bCountry": null,
               "attributeTags": {},
               "createdBy": "b0dedbd2-ecc7-4bad-a13b-6c34b4005115",
               "buyoutPort": null,
               "virtual": false,
               "locked": false,
               "adminLocked": false,
               "bgpShutdownDefault": false
           },
           "connectType": "AWSHC",
           "payerConfig": {},
           "nonPayerConfig": {},
           "attributeTags": {},
           "serviceLicense": null,
           "fullyApproved": true
       }
   ]
}


```

The VXC will now appear in the Megaport Portal.

For this example, the AWS Hosted Connection will appear in the AWS portal account under Direct Connect - connection. The account holder can accept the Hosted Connection and create one private, one public or one transit VIF, and connect it to a Virtual Private Gateway or a Direct Connect Gateway or Transit Gateway, and then to their VPCs.
