> ## 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 Connection using a Service Key

> This help topic describes how to create a service key to share your connection

export const topic_0 = "connection using a service key"

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

A service key is a code that is given by one Megaport account holder to another to connect two separate businesses together. Customers who have separate Megaport accounts can connect their Ports, MCRs, MVEs, and NAT Gateways to each other across the Megaport network, enabling business-to-business VXCs.

This topic will help you if you have been given a service key to set up a connection to another company's service.

For more information about service keys, see [Setting up Service Keys](/marketplace/service-keys).

**Prerequisites**

Before you create a { topic_0 }, ensure that you have:

* Access to the Megaport Portal.
* A Port, MCR, MVE, or NAT Gateway on the Megaport network.

**To create a connection with a service key**

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

   <Note>
     In this example, we are using a Port, but you can also use an MCR, MVE, or NAT Gateway.
   </Note>

2. Click **+Connection** then click **Enter Service Key**.
   <Image src="/images/service-key-enter.png" alt="Enter Service Key" shadow={true} width={850} />

3. Enter the service key in the **Megaport Service Key ID** field.\
   Megaport validates the key and displays basic information about the key.
   <Image src="/images/marketplace/service-key-valid.png" alt="Service key validation" shadow={true} width={600} />

4. Click **Next**.

5. 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, up to the maximum limit defined by the key.

   * **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** -- You might be asked to specify an A-End vNIC. Select an available vNIC from the drop-down list.

   * **Preferred A-End VLAN** (optional) -- Specify an unused VLAN ID for this connection.\
     This must be a unique VLAN ID on this Port 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.

     The **B-End VLAN** for the provider-side termination will be automatically populated based on the service key.

   * **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/marketplace/service-key-connection-details.png" alt="This image shows a summary of the details of the added VXC for review." shadow={true} width={600} />

6. Click **Next**.\
   A summary page appears that includes the monthly cost. Click **Back** to make changes or click **Add VXC** to move this configuration to your cart.

   <Image src="/images/marketplace/service-key-summary.png" alt="This image shows a summary of the details of the added VXC for review." shadow={true} width={500} />

7. After ordering the key, a notification is sent to the company that you are connecting to, and the connection is completed automatically.
   The service key VXC will appear in the Megaport Portal for both companies as shown below.

   <Image src="/images/marketplace/service-key-connections.png" alt="This image shows the service key VXC that both companies will see in the Megaport Portal" shadow={true} width={800} />
