> ## 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 an AWS Hosted VIF for an MVE with Versa Secure SD-WAN

> This help topic describes how to create a Hosted VIF from an MVE to AWS Direct Connect and integrate the connection with Versa Secure SD-WAN.

export const Image = ({src, alt = '', caption, width, height, shadow}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Image -';
  if (typeof src !== 'string') {
    src = String(src);
  }
  if (!src || src === 'undefined') {
    console.error(`${errorPrefix} \`src\` is required — rendering an empty string instead`);
    return <></>;
  }
  const img = <img className={['mega-image-style', shadow ? 'shadow' : ''].join(' ')} src={src} alt={alt} width={width} height={height} style={{
    display: 'block'
  }} />;
  return caption ? <figure>
      {img}
      <figcaption style={{
    textAlign: 'center',
    width
  }}>{caption}</figcaption>
    </figure> : img;
};

export const Gloss = ({term, anchor, langDir = 'en'}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Gloss -';
  if (typeof term !== 'string') {
    term = String(term);
  }
  if (typeof anchor !== 'string') {
    anchor = String(anchor);
  }
  if (!term || term === 'undefined') {
    console.error(`${errorPrefix} the \`term\` property is required — rendering an empty string instead`);
    return <></>;
  }
  if (!anchor || anchor === 'undefined') {
    console.error(`${errorPrefix} the \`anchor\` property is required — rendering an empty string instead`);
    return <></>;
  }
  const lang = langDir === 'en' ? '/' : '/' + langDir + '/';
  const glossaryPage = lang + 'glossary/#' + anchor;
  return <a href={glossaryPage}>{term}</a>;
};

export const InlineImage = ({src, alt, height = 16, shadow, width}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: InlineImage -';
  if (typeof src !== 'string') {
    src = String(src);
  }
  if (!src || src === 'undefined') {
    console.error(`${errorPrefix} \`src\` is required — rendering an empty string instead`);
    return <></>;
  }
  if (typeof alt !== 'string') {
    alt = String(alt);
  }
  if (alt === 'undefined') {
    console.error(`${errorPrefix} \`alt\` is required (use "" for decorative images) — rendering an empty string instead`);
    return <></>;
  }
  if (height) {
    height = height.toString().replaceAll(/\D/g, '');
  }
  if (width) {
    width = width.toString().replaceAll(/\D/g, '');
  }
  return <img className={['inline-icon', shadow ? 'shadow' : null, 'm-0'].filter(Boolean).join(' ')} src={src} alt={alt} height={height} width={width} style={{
    display: 'inline',
    verticalAlign: 'middle',
    maxHeight: height ? `${height}px` : undefined,
    maxWidth: width ? `${width}px` : undefined,
    height: height ? `${height}px` : undefined,
    width: width ? `${width}px` : undefined
  }} />;
};

export const Link = ({href, children}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Link -';
  if (typeof href !== 'string') {
    href = String(href);
  }
  if (!href || href === 'undefined') {
    console.error(`${errorPrefix} the \`href\` property is required — rendering an empty string instead`);
    return <></>;
  }
  if (href.includes('{') || href.toUpperCase().includes('%7B')) {
    console.error(`${errorPrefix} could not resolve a variable in href "${href}" — rendering an empty string instead`);
    return <></>;
  }
  const isExternal = (/^https?:\/\//).test(href);
  return <a href={href} className="link" target={isExternal ? '_blank' : undefined} rel={isExternal ? 'noreferrer' : undefined}>
      {children ?? href}
      {isExternal && <span className="sr-only"> (opens in a new tab)</span>}
    </a>;
};

Hosted VIFs can connect to public or private AWS cloud services: a Hosted VIF cannot connect to a transit virtual interface. These connections share bandwidth.

<Note>
  AWS Hosted Virtual Interfaces (Hosted VIF) do not support diversity zones. To ensure connection diversity for Hosted VIFs, create VXCs to two destination ports in different data centers, instead of two ports in separate diversity zones.
</Note>

**To create a connection to an AWS Hosted VIF from the Megaport Portal**

1. In the <Link href="https://portal.megaport.com">Megaport Portal</Link>, go to the **Services** page and select the MVE for the connection.

2. Click **+Connection** then click **Cloud**.

3. Select AWS as the service provider, select Hosted VIF as the AWS Connection Type, select the destination port, then click **Next**.\
   You can use the Select Destination Port search field to narrow the selection.
   <Image src="/images/cloud/megaport/aws/aws-hosted-vif.png" alt="Add Hosted VIF connection" shadow={true} width={700} />

4. Specify the connection details:

   * **Connection Name** -- The name of your VXC to be shown in the <Link href="https://portal.megaport.com">Megaport Portal</Link>.

     <Tip>
       Match this to the AWS Connection Name on the next screen for easy mapping.
     </Tip>

   * **Service Level Reference** (optional) -- Specify a unique identifying number for your Megaport service to be used for billing purposes, such as a cost center number, unique customer ID, or purchase order number. The service level reference number appears for each service under the Product section of the invoice. You can also edit this field for an existing service.

   * **Rate Limit** -- The speed of your connection in Mbps. Accepted values start at 1 Mbps and scale in 1 Mbps increments. Maximum available speed depends on location and service availability. Note the sum of all hosted virtual VXCs to a service can exceed the MVE capacity, but the total aggregate will never burst beyond the MVE capacity.

   * **VXC State** -- Select **Enabled** or **Shut Down** to define the initial state of the connection. For more information, see [Shutting Down a VXC for Failover Testing](/connections/shut-down-vxc).

     <Note>
       If you select **Shut Down**, traffic will not flow through this service and it will behave as if it was down on the Megaport network. Billing for this service will remain active and you will still be charged for this connection.
     </Note>

   * **A-End vNIC** -- Select an A-End vNIC from the drop-down list. For more information about vNICs, see [Creating an MVE in the Megaport Portal](/mve/versa/creating-mve#creating-mve).

   * **Preferred A-End VLAN** (optional) -- Specify an unused VLAN ID for this connection.\
     This must be a unique VLAN ID on this MVE and can range from 2 to 4093. If you specify a VLAN ID that is already in use, the system displays the next available VLAN number. The VLAN ID must be unique to proceed with the order. If you don't specify a value, Megaport will assign one.

   * **Minimum Term** -- Select No Minimum Term, 12 Months, 24 Months, 36 Months, 48 Months, or 60 Months. Longer terms result in a lower monthly rate. *12 Months* is selected by default. Take note of the information on the screen to avoid early termination fees (ETF).

     Enable the [Minimum Term Renewal](/portal-admin/auto-renew/#auto-renew) option for services with a 12, 24, 36, 48 or 60-month term to automatically renew the contract at the same discounted price and term length at the end of the contract. If you don't renew the contract, at the end of the term,  the contract will automatically roll over to month-to-month contract for the following billing period, at the same price, without term discounts.

     For more information, see [VXC Pricing and Contract Terms](/finance/vxc-pricing) and [VXC, Megaport Internet, and IX Billing](/finance/billing-details).

   * **Resource Tags** -- You can use resource tags to add your own reference metadata to a Megaport service.\
     To add a tag:
     1. Click **Add Tags**.
     2. Click  **Add New Tag**.
     3. Enter details into the fields:
        * **Key** -- string maximum length 128. Valid values are a-z 0-9 \_ : . / \ -
        * **Value** -- string maximum length 256. Valid values are a-z A-Z 0-9 \_ : . @ / + \ - (space)
     4. Click **Save**.
        If you already have resource tags for that service, you can manage them by clicking **Manage Tags**.
     <Warning>
       Never include sensitive information in a resource tag. Sensitive information includes commands that return existing tag definitions and information that will identify a person or company.
     </Warning>

   <Image src="/images/cloud/mve/portal-cloud-create-details.png" alt="Connection details" shadow={true} width={550} />

5. Click **Next**.

6. Specify the details for the AWS service.

   <Image src="/images/cloud/mve/aws-hv-connection-details-mp.png" alt="AWS connection details" shadow={true} width={700} />

   Here are details for each field:

   * Select **Public** or **Private**.
     * **Private** -- Access private AWS services such as a VPC, EC2
       instances, load balancers, RDS DB instances, on private IP address space.
     * **Public** -- Access public AWS services such as Amazon Simple Storage
       Service (S3), DynamoDB, CloudFront, and Glacier. You will also receive
       [Amazon's global IP prefixes](https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html)
       (approximately 2,000 prefixes).

       <Note>
         Public VIFs require manual intervention from Amazon and could take up to 72 hours. For more information, see [Configuring Public AWS Connections with IP Addresses Provided by AWS](/cloud/megaport/aws/aws-public-ip).
       </Note>

   * **AWS Connection Name** -- This is a text field and will be the name
     of your virtual interface that appears in the AWS console. The AWS
     Connection Name is automatically populated with the name specified in a
     previous step.

   * **AWS Account ID** -- This is the ID of the account you want to
     connect. You can find this value in the management section of your
     AWS console.

   * **Customer ASN** (optional) -- Specify the ASN used for
     BGP peering sessions on any VXCs connected to the MVE. This value
     is defined when you configure the MVE and, once defined, it cannot
     be changed.

   * **BGP Auth Key** (optional) -- Specify the BGP <Gloss term="MD5" anchor="md5" /> key. If you leave this blank, Megaport negotiates a key automatically for you with AWS which will be displayed in the Megaport Portal. The key is not displayed in the AWS console.
     <Note>
       The BGP Auth Key is generated during the ordering process when this field is left blank. It will not be displayed on the Summary page when ordering. To see the key, view the Connection Settings after the service has been deployed and is live.
     </Note>

   * **Customer IP Address** -- The IP address space (in CIDR format) used on your network for peering. This field is optional for private connections and if left blank, Megaport assigns an address.

   * **Amazon IP Address** -- The IP address space in CIDR format
     assigned in the AWS VPC network for peering. This field is
     optional for private connections and if left blank, Megaport automatically assigns an
     address.

   * **Prefixes** (optional) -- (visible for Public connections only) Specify IP Prefixes to announce to AWS. Specify the prefixes you will advertise when deploying a Public Direct Connect (RIR-assigned IPv4 addresses only).

     Once you configure Prefixes for a Public connection, you cannot change them and the field is grayed out. To change this value, create a support ticket with AWS so they can make this change in a non-impacting way. Or, you can cancel the Hosted VIF and reorder. In both cases, you need to wait for AWS to manually approve the request.

7. Click **Next** to proceed to the connection detail summary, then click **Add VXC**.

8. Click **Review Order** to proceed through the checkout process, or click **Save** to save the configured services before placing the order.

9. Review the Important Information section and confirm agreement with the Service Agreements.

   If you do not have a promotion code, skip to the **Order Now** step. If you do have a promotion code, enter it into the **Enter discount code** field then click **Apply**. Alternatively, if a code already appears in the **Discounts** field, verify it is correct and click **Apply**.

   The promotional discount appears below the Standard Term discount.  This discount is not reflected in the Monthly Rate shown here, it is applied at the time of billing.  If an invalid or expired code causes an error with your order, contact your Megaport Account Manager for a replacement code.

   <Image src="/images/snippets/add-promo-code.png" alt="Add Promo Code" shadow={true} width={750} />

   If you entered an incorrect promotion code, you can remove it by clicking **Remove**.

10. Click **Order Now**.

The AWS VXC appears as a connection for the MVE in the Megaport Portal.

<Image src="/images/cloud/mve/aws-vxc-mve.png" alt="VXC details" shadow={true} width={700} />

Next, accept the connection in AWS.

#### Accepting the Virtual Interface for Private Connections

A few minutes after ordering a private Hosted VIF VXC, the
corresponding inbound VIF request is visible on the AWS Direct
Connect > Virtual Interfaces page in the AWS console. (This is specific to the region associated with the target AWS port.) If your VIF doesn't appear after a few minutes, confirm you are viewing the correct region.

**To review and accept the private virtual interface**

1. From the AWS Direct Connect > Virtual Interfaces page, click the ID
   of the interface to display the configuration and peering details.

   <Image src="/images/cloud/mcr/aws-hv-accept-virtual-interface.png" alt="Accepting AWS Virtual Interfaces" shadow={true} width={800} />

   The name and account ID of the VIF should match the values supplied in
   the Portal and the BGP ASN should match the Customer ASN configured with
   the VXC. The Amazon ASN is the default region's AWS ASN and
   not the value specified during the configuration - this is
   updated when the virtual interface is accepted and
   assigned.

2. Click **Accept**.

3. Select the gateway type and then the specific gateway for this new
   virtual interface.
   <Image src="/images/cloud/mcr/aws-hv-aws-gateway.png" alt="Specify a gateway" shadow={true} width={600} />

4. Click **Accept virtual interface**.

The state of the connection changes from *confirming* to *pending*, and then changes to *available* once BGP is established. Note that sometimes there is a delay in the *available* BGP status appearing on the AWS end, though you can confirm the current state of the Layer 3 link through the Portal view.

#### Accepting the Virtual Interface for Public Connections

Several minutes after ordering a public Hosted VIF VXC, the
corresponding inbound VIF request appears on the **AWS Direct
Connect > Virtual Interfaces** page in the AWS console. (This is specific to the region associated with the target AWS port.)

**To review and accept the public virtual interface**

1. From the AWS Direct Connect > Virtual Interfaces page, click the ID
   of the interface to display the configuration and peering details.
2. Review the configuration details and click **Accept**, and when
   prompted, click **Confirm**.

The state of the connection changes from *confirming* to *verifying*. At
this point, the connection needs to be verified by Amazon - a process
that can take up to 72 hours. When verified, the state changes to
*available*.

## Adding AWS connection details to Versa Director

After you create the connection from your MVE to AWS and set up the connection in the AWS console, you need to configure it in Versa Director. This involves revising Versa Director templates to add a device interface and configure BGP settings, ASNs, VLANs, and MD5 values.

**To add a subinterface in Versa Director**

1. Collect the connection details from the Megaport Portal.

   To display the details, click the gear icon <InlineImage src="/images/buttons/gear-icon.png" alt="Gear icon" /> for the AWS connection from your MVE and click the **Details** view. Note the values for the **A-End VLAN**, **Customer Address** (and **CIDR**), **Amazon IP Address**, and **Customer ASN**.

   <Image src="/images/cloud/mve/versa/aws/aws-connection-details-mp.png" alt="AWS connection details" shadow={true} width={700} />

2. Log in to Versa Director.

3. Select the **Workflows** tab in the top menu bar.

4. Select Template > Templates in the left navigation.

   <Image src="/images/cloud/mve/versa-choose-template.png" alt="Choose template" shadow={true} width={700} />

5. Click the template you want to edit, then select the **Interfaces** tab.

6. In the WAN Interfaces section, locate the Sub Interface column and click <InlineImage src="/images/mve/versa/add-icon-green.png" alt="Add icon" /> (Add) to add a subinterface.

   <Image src="/images/cloud/mve/versa/aws/aws-director-addsubint.png" alt="Add a subinterface" shadow={true} width={700} />

   A new row appears in the table.

7. Specify these values for the new subinterface.

   * **VLAN ID** -- Enter the VLAN value from the Megaport Portal.

   * **Network Name** -- Choose **+ Create WAN Network** from the drop-down menu to open the Create WAN Network window. Specify a meaningful name for the network, click **OK**, and then select the WAN network you created.

   * **IPv4** -- Choose Static from the drop-down menu.

   <Image src="/images/cloud/mve/versa/aws/aws-director-int-tab.png" alt="Subinterface details" shadow={true} width={700} />

8. Select the **Routing** tab to add BGP configuration information.

9. In the BGP section, select the network name for the connection in the Network column.

   <Image src="/images/cloud/mve/versa/aws/aws-director-routing-tab.png" alt="BGP details" shadow={true} width={700} />

10. Specify the following values according to your MVE configuration:

    * **Local AS** -- This is the Customer ASN (your local MVE), collected in Step 1.
    * **Neighbor IP Address** -- This is the Amazon IP address, collected in Step 1.
    * **Peer AS** -- This is the AWS ASN. By default, this value is 64512.
    * Optionally, you can enable BFD (as appropriate for your network).

11. Click <InlineImage src="/images/mve/versa/add-icon-green.png" alt="Add icon" /> (Add) to the right of the settings.

12. Click **Recreate** (at the bottom of the page).

    A window opens that shows the differences of the configuration. The auto-merged version is recommended, and selected by default.

13. Click **Deploy**.

You can use variables in the template to specify values per device for these fields: **Router ID**, **Local AS**, **Peer AS**, **Static IP address**, and **Password**.

<Note>
  The Instance ID cannot be modified (the system automatically specifies a value) and **Static IP Address** is parameterized by default.
</Note>

**To parameterize Router ID, BGP Local AS, Peer AS, and Password**

1. Select the **Configuration** tab in the top menu bar.

2. Select **Templates** > **Device Templates** in the horizontal menu bar.

   <Image src="/images/cloud/mve/versa/aws/aws-director-config-templates-devicetemps.png" alt="Device Templates" shadow={true} width={700} />

3. Click your template.

   By default, the Interfaces column appears.

4. In the left navigation, select **Virtual Routers**, and click your device to open the Edit window.

   <Image src="/images/cloud/mve/versa/aws/aws-director-virtual-routers.png" alt="Edit device templates" shadow={true} width={700} />

5. In the Edit window, select BGP, then click the Instance ID to open the Edit BGP Instance window.

   <Image src="/images/cloud/mve/versa/aws/aws-director-edit-bgp.png" alt="Edit BGP Instance window" shadow={true} width={700} />

6. In the Edit BGP Instance window, click <InlineImage src="/images/mve/versa/parameterize-icon.png" alt="Parameterize icon" /> (Parameterize) next to each of the following fields: **Router ID**, **Local AS**, **Peer AS**, and **Password**.

   <Image src="/images/cloud/mve/versa/aws/aws-director-edit-bgpinstance.png" alt="Parameterize fields" shadow={true} width={700} />

7. Click **OK** two times to update.

8. Select the **Workflows** tab in the top menu bar, then select Devices > Devices in the left navigation.

9. Click your device to specify values for the variables you just created.

   <Image src="/images/cloud/mve/versa/aws/aws-director-devices-devices.png" alt="Define variables" shadow={true} width={700} />

   The Add Device window opens.

10. Select the **Bind Data** tab.

    <Image src="/images/cloud/mve/versa/aws/aws-director-bind-data.png" alt="Bind Data tab" shadow={true} width={700} />

11. Specify values for the variables.

    * **Local AS** -- Enter the Customer ASN.
    * **Password** -- Enter the MD5 password.
    * **Peer AS** -- Enter the Amazon side ASN.
    * **Router ID** -- Enter the Customer IP address (your local IP address).
    * **Hop Address** -- Enter the Amazon IP address.
    * **Static Address** -- Enter the Customer IP address (your local IP address, including the mask value).

12. Click **Redeploy** when finished.

    When the new configurations for the device are prepared successfully, a green checkmark appears at the bottom of the Versa Director window.

13. To push the changes to the device, click **Commit Template** (on the upper right).

    <Image src="/images/cloud/mve/versa/aws/aws-director-committemplate.png" alt="Commit Template link" shadow={true} width={700} />

    The Commit Template to Devices window opens.

    <Image src="/images/cloud/mve/versa/aws/aws-director-commit-dialog.png" alt="Commit Template" shadow={true} width={700} />

14. Specify the following in the Commit Template to Devices window:

    * **Organization** -- Select your organization from the drop-down menu.

    * **Select Template** -- Select the template to push to the device from the drop-down menu.

    Note that the Template State is OUT\_OF\_SYNC.

15. Click the eye icon in the Differences column to verify your configuration changes.

16. Click **Commit to Device**.

    A green checkmark appears at the bottom right of the screen when the push is successful. The Template State is now IN\_SYNC.

17. Close the window.

## Validating your AWS connection

1. Select the **Monitor** tab in the top navigation bar, select Devices in the horizontal navigation bar, and then select your device to view details in the Summary screen.

   <Image src="/images/cloud/mve/versa/aws/aws-director-monitor-device.png" alt="AWS Session Status" shadow={true} width={700} />

2. In the Summary screen you can review your subinterface in the Interface column, and the Operational and Admin Status.

   <Image src="/images/cloud/mve/versa/aws/aws-director-monitor-details.png" alt="AWS Session Summary" shadow={true} width={700} />

3. In the AWS Direct Connect portal, refresh the screen and verify that the Virtual interface state is available and BGP Status is up. An AWS BGP session that is up looks like this:

   <Image src="/images/cloud/mve/versa/aws/aws-bgp-session-up.png" alt="AWS session from AWS side" shadow={true} width={700} />

**To view the BGP status for a device in Versa Director**

1. Log in to Versa Director.

2. Select the **Monitor** tab in the top menu bar.

3. Select your device from the list.
   <Image src="/images/cloud/mve/versa/aws/aws-director-device-list.png" alt="Director device list" shadow={true} width={500} />

4. Scroll to the Health Monitor.

5. Click **BGP Adjacencies** to view the BGP status.
   <Image src="/images/cloud/mve/versa/aws/aws-director-health-monitor.png" alt="Health Monitor" shadow={true} width={300} />

6. Verify whether the BGP status for the device is *Established*.
   <Image src="/images/cloud/mve/versa/aws/aws-director-device-bgp-details.png" alt="BGP details" shadow={true} width={900} />
