> ## 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 MCR Connections to AWS

> This help topic describes how to create a VXC from an MCR to AWS Direct Connect.

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 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>;
};

You can create a VXC from an MCR to AWS Direct Connect (DX) through the <Link href="https://portal.megaport.com">Megaport Portal</Link>. Follow the steps in this topic to establish a private, public, or transit VIF connection that can connect either directly to a selected VPC or to a range of VPCs either in a single or multiple AWS regions (within a single AWS account).

## Prerequisites

### Private Virtual Interface

Before you create a private connection from an MCR to AWS, make sure you have the following:

* Your
  [AWS Account number](https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html#FindingYourAccountIdentifiers).
* An AWS
  [virtual private gateway](https://docs.aws.amazon.com/vpn/latest/s2svpn/SetUpVPNConnections.html) or
  [Direct Connect gateway](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-gateways.html) associated with your VPCs.
* The ASN number for the AWS gateway.\
  When creating the AWS gateway, we recommend private ASNs for private connections
  and we recommend replacing the AWS default ASN (usually 7224) as routing multiple
  VXC instances to the same target ASN can result in routing anomalies.
* An MCR.\
  If you don't currently have an MCR, create one following the procedures
  in [Creating an MCR](/mcr/creating-mcr).

<Note>
  The preferred manner for inter-region peering is multiple VXCs
  from a single MCR with individual connections to VGWs (often abbreviated
  VGW). (This model also supports inter-region peering between VPCs from
  multiple accounts.) Direct Connect gateways can aggregate multiple VGWs
  from local and remote regions and this method is more extensible than
  the VGW option, however, this option requires careful consideration of
  traffic paths and latency implications. We recommend that you consult
  the AWS documentation for information on the rules and limits imposed on the
  connection types.
</Note>

### Public Virtual Interface

You can create a public virtual interface to connect your MCR to public resources (non-VPC services).

To connect to public resources such as Amazon Simple Storage Service
(S3) and Amazon DynamoDB, AWS generally requires you to bring public IP
addresses to this connection. However, with the MCR, Megaport supplies a
/31 range for public peering and for the global AWS route tables.

Public VIFs are not required to terminate onto a virtual private gateway
or Direct Connect gateway and the target ASN will be the AWS public ASN
for the destination region.

For a public connection, you need your AWS Account number.

### Transit Virtual Interface

Before you create a transit connection from an MCR to AWS, make sure you
have the following:

* Your [AWS Account number](https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html#FindingYourAccountIdentifiers).
* An AWS [transit gateway](https://docs.aws.amazon.com/vpc/latest/tgw/tgw-getting-started.html)
  attached to your Direct Connect gateway.
* The ASN number for the Direct Connect gateway attached to the transit gateway.
* An MCR.

## Connecting an MCR to AWS Direct Connect

Once you have the prerequisites met, you can create the VXC to AWS from the MCR.

The VXC connection can be one of two AWS models: Hosted VIF or Hosted Connection.

Hosted VIFs can connect to public or private AWS cloud services: a
Hosted VIF cannot connect to a transit virtual interface. The Hosted VIF
is fully integrated with AWS and provides access to the routing
information for automatic configuration of your MCR BGP peering.

A Hosted Connection can support one private, public, or transit virtual
interface. The Hosted Connection configuration process does not have
automatic access to routing information for the MCR and you need to
configure the routing manually and specify BGP peering details on both
the AWS virtual interface and the MCR A-End configuration in the Megaport Portal.

For more information about each connection type, see [Connecting to AWS Direct Connect](/cloud/megaport/aws).

**Overview of the workflow**

The following flowchart outlines the steps to set up an AWS Hosted VIF or Hosted Connection between your device and AWS via Megaport.

<Image src="/images/cloud/mcr/aws-ladder-chart.png" alt="AWS Ladder Chart" shadow={true} width={700} height={455} />

## Creating a Hosted VIF connection

<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 Hosted VIF VXC from an MCR to AWS**

1. In the <Link href="https://portal.megaport.com">Megaport Portal</Link>, go to the **Services** page and select the MCR you want to use.

2. Click **+Connection** and 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/mcr/aws-hosted-vif.png" alt="Add Hosted VIF connection" shadow={true} width={700} height={455} />

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>.

   * **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.

   * **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>

   * **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 shadow={true} alt="Connection details" src="/images/cloud/mcr/mcr-cloud-create-details.png" width={600} />

5. Click **Next**.

6. Click **Next** to acknowledge the MCR Connection details.

7. Specify the connection details for the AWS service.

   For private Hosted VIFs, only the AWS Connection Name, AWS Account ID,
   and Amazon ASN fields are mandatory. For public Hosted VIFs, only the
   AWS Connection Name and AWS Account ID are mandatory.

   For both public and private connections, the BGP peering fields (BGP
   Auth Key, Customer IP Address, and Amazon IP Address) are automatically populated
   when the connection is created - although you can enter manual values if
   you have specific requirements.

   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) -- Specifies the ASN used for
     BGP peering sessions on any VXCs connected to the MCR. This value
     is defined when you configure the MCR and, once defined, it cannot
     be changed. The default value is the Megaport public ASN 133937.

   * **Amazon ASN** -- For private connections, this value needs to match
     either the ASN for the AWS virtual private gateway (for 1:1 VPC
     connections) or the ASN for the AWS Direct Connect gateway. For public connections, if you supply this value, it will be ignored and the ASN will be the AWS public ASN for the destination region.

   * **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** (optional) -- The IP address space (in CIDR format) used on your network for peering. If left blank, Megaport assigns an address.

   * **Amazon IP Address** (optional) -- The IP address space in CIDR format assigned in the AWS VPC network for peering. 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.

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

8. Click **Next** to proceed to the connection detail summary, and add the
   VXC to the cart.

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

10. 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**.

11. Click **Order Now**.

Once the VXC connection is deployed successfully, it appears on the Portal Services page associated with the MCR.

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

Click the VXC title to display the details of this connection.

<Note>
  For private connections, in the Details section, the service
  status (Layer 2) is up but BGP (Layer 3) will be down because the
  matching configuration does not exist on the AWS side. This will be
  configured once you accept the virtual interface in the AWS console.
</Note>

#### Accepting the Virtual Interface for Private Connections

Two to three 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 that you are viewing the correct region.

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

1. From the AWS Direct Connect > Virtual Interface page, click the ID
   of the interface to display the configuration and peering details.
   <Image shadow={true} alt="AWS Virtual Interfaces" src="/images/cloud/mcr/aws-hv-accept-virtual-interface.png" 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 Side ASN is the default region's AWS ASN and
   not the value specified during the configuration - this is
   updated in the next step 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 shadow={true} alt="Specify a gateway" src="/images/cloud/mcr/aws-hv-aws-gateway.png" width={600} />
4. Click **Accept virtual interface**.

After you accept the interface, the Amazon side ASN field changes to the
ASN value specified in the configuration. The state of the connection
changes from *confirming* to *pending*, and then changes to *available* once BGP has
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 Interface 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*.

## Creating a Hosted Connection

**To create a Hosted Connection VXC from an MCR to AWS**

1. In the <Link href="https://portal.megaport.com">Megaport Portal</Link>, go to the **Services** page and select the MCR you want to use.

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

3. Select AWS as the service provider, select Hosted Connection 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. You can also filter by diversity zone.\
   Each destination port has either a blue or red icon to indicate its diversity zone. To achieve diversity, you need to create two connections with each one in a different zone.
   <Image shadow={true} alt="Specify a connection type and destination" src="/images/cloud/mcr/aws-hosted-connection.png" 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>.

   * **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.

   * **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>

   * **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 shadow={true} alt="Connection details" src="/images/cloud/mcr/mcr-cloud-create-details.png" width={600} />

5. Click **Next**.

6. For the MCR Connection detail, provide an IP address in CIDR format.\
   This value is the IP address for the interface and is the MCR IP address
   used for BGP peering to AWS.

   <Image shadow={true} alt="Router IP address" src="/images/mcr/mcr-a-end-vxc.png" width={600} />

   Assign a /30 address in private address space.

   You can add a secondary IP address, if needed.

   <Note>
     You can change these values in the A-End details of the VXC configuration.
   </Note>

7. Click **Add BGP Connection** and specify these values:

   * **Local IP** -- The IP address on this interface that communicates
     with the BGP peer. The menu is automatically populated based on the address
     you specified as interface IP addresses.

   * **Peer IP** -- The IP address for the BGP peer. In this example, the
     local IP is 192.168.100.1 so the peer IP address would be
     192.168.100.2.

   * **Peer ASN** -- The ASN of the AWS gateway.

   * **BGP Password** -- The shared key to authenticate the peer. This field is optional for the creation of the VXC, but is required to set up
     the BGP peering. You can add it after you create the VXC.

     The shared key length is from 1 to 25 characters. The key can include any of these characters:

     a-z\
     A-Z\
     0-9\
     ! @ # . \$ % ^ & \* + = - \_

     <Tip>
       Click the eye icon to see the password as you type. The view persists until you click the eye icon again to hide the password.
     </Tip>

   * **Description** (optional) -- Enter a description that will help identify this connection. The minimum description length is from 1 to 100 characters.

   * **BGP State** -- Shuts down the connection without removing it. The initial setting will be taken from the setting on the A-End of the MCR. Enabling or shutting down the BGP state does not affect existing BGP sessions. The BGP state only affects new VXCs. This setting overrides the MCR state for an individual connection. For more information, see [Creating an MCR](/mcr/creating-mcr).

   When you create the virtual interface in the AWS console for this
   connection, you will match these values.

   <Image shadow={true} alt="BGP details" src="/images/cloud/mcr/aws-hc-aws-details.png" width={850} />

8. Click **Add**.\
   The BGP details appear under BGP Connection details.

9. Click **Next**.

10. Specify the connection details for the AWS service.

    * **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.

      <Image shadow={true} alt="AWS details" src="/images/cloud/mcr/aws-hc-service-details.png" width={450} />

11. Click **Next** to proceed to the connection detail summary, click **Add VXC**, and order the connection.

Once the VXC connection is deployed successfully, it appears on the Megaport Portal Services page and is associated with the MCR. Click the VXC title to display
the details of this connection. Note that the service status (Layer 2) is up but BGP (Layer 3) will be down because the configuration does not exist yet.

Once deployed in the Megaport Portal, you need to set up the connection in the AWS console:

1. In AWS, accept the connection.\
   To review and accept in the AWS console, go to **Services > AWS Direct Connect > Connections** and click the connection name to review the details and accept. For more information, see the [AWS
   documentation](https://docs.aws.amazon.com/directconnect/latest/UserGuide/accept-hosted-connection.html).\
   The state will be pending for a few minutes while AWS deploys the connection.

2. In the AWS console, click **Create Virtual Interface** and create a virtual interface for the hosted connection. Ensure you enter these values for BGP peering:

   * **Your router peer IP** -- The BGP peer IP configured on the MCR.

   * **Amazon router peer IP** -- The BGP peer IP configured on the AWS endpoint.

   * **BGP authentication key** -- The password used to authenticate the BGP session.

   Important details to note:

   * AWS provides [detailed steps](https://docs.aws.amazon.com/directconnect/latest/UserGuide/create-vif.html) for creating Public, Private, and Transit interfaces.

   * The name you provided for the connection in the Megaport Portal appears in the Connection list on this page.

   * The VLAN is populated and appears to be editable; however, you will get an error if you try to change it.

Once you accept the Hosted Connection in AWS and create a virtual interface with the BGP peering settings, the VXC state changes to configured in the Megaport Portal.

## Using a service key

You can create a service key that allows you to share your service with another Megaport account holder.
For more information, see [Setting up Service Keys](/marketplace/service-keys/).
