> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/cloud-networking/get-started/validate-connection-in-public-cloud/amazon-web-service-aws-configuration.md).

# AWS Direct Connect Configuration

The AWS side of the setup: create the gateways, accept the hosted connection, create the virtual interface, and bring up BGP.

## Background Information

AWS Direct Connect (DX) is the dedicated connectivity service AWS provides between your on-premises environment and the AWS cloud. Through any Zenlayer DX point of presence, you can build a private link between your own data center — or another cloud — and AWS.

Unlike a VPN over the public internet, DX runs end to end on dedicated physical circuits between the provider and AWS. It is isolated from the internet, which keeps bandwidth predictable and improves security and reliability.

Depending on how you configure it on the AWS console, Direct Connect supports three types of virtual interface (VIF):

* **Public VIF** — reaches AWS public service endpoints such as Amazon S3 and DynamoDB, which do not live inside a VPC.
* **Private VIF** — connects directly to your VPC and reaches resources inside it (EC2 instances, Elastic Load Balancers) over the private IP addresses you planned.
* **Transit VIF** — associates the Direct Connect gateway with an AWS Transit Gateway, so one connection serves your data center, several VPCs, and traffic between those VPCs.

Your on-premises workloads reach AWS over a virtual circuit Zenlayer provides, landing at a Direct Connect location:

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-4134715dda00ae812d2d8309a7b8d6d150835bf8%2Faws-dx-overview.png?alt=media" alt=""><figcaption><p>How an AWS Direct Connect connection fits together</p></figcaption></figure>

## Terminology

| Term                              | Description                                                                                                                                        |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **VPC** (Virtual Private Cloud)   | A regional virtual network environment in your AWS account                                                                                         |
| **VGW** (Virtual Gateway)         | The virtual private gateway of a VPC                                                                                                               |
| **DXGW** (Direct Connect Gateway) | A globally available gateway that can associate VGWs from multiple regions — the core component of the connection and the one that carries the VIF |
| **TGW** (Transit Gateway)         | A regional network hub that can connect a large number of VPCs in the same region                                                                  |
| **VIF** (Virtual Interface)       | The logical port on the AWS side, in Public, Private, or Transit flavor                                                                            |

The definitions follow the [**AWS Direct Connect FAQs**](https://aws.amazon.com/directconnect/faqs/).

## Procedures

The AWS-side setup runs as follows:

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-8b312a4432988444185a237b857c7a2239372475%2Faws-direct-connect-flow.svg?alt=media" alt=""><figcaption><p>AWS-side setup flow</p></figcaption></figure>

The example below connects to AWS Direct Connect over the Zenlayer network; once a Private VIF is configured, you reach private resources such as EC2 instances inside the VPC:

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-646ca317071a5d0b5715dfed0a0747ed4f7c4b41%2Faws-dx-architecture.png?alt=media" alt=""><figcaption><p>VPCs in several regions reaching AWS through a DXGW / TGW</p></figcaption></figure>

BGP between your side and AWS can be set up in two ways:

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-2704006c91ea4ef8b343dc75f3e98719a1735f2a%2Faws-dx-bgp-peering-modes.png?alt=media" alt=""><figcaption><p>The two BGP peering arrangements</p></figcaption></figure>

{% stepper %}
{% step %}
**Create the virtual private gateway (VGW)**

On the Direct Connect page, go to **Virtual private gateways** and click **Create virtual private gateway**. You can set the VGW's ASN yourself or keep the AWS default, `64512`.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-50602738a880afe14353a4efccded0ec9c3fba4b%2Faws-dx-vgw-1.png?alt=media" alt=""><figcaption><p>Create the virtual private gateway</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-9ba740b4dc90fa5ed6321d8ae1e708e26647db2e%2Faws-dx-vgw-2.png?alt=media" alt=""><figcaption><p>Name the VGW and set its ASN</p></figcaption></figure>
{% endstep %}

{% step %}
**Create the Direct Connect gateway (DXGW)**

On the Direct Connect page, go to **Direct Connect gateways** and click **Create Direct Connect gateway**.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-cbd4abb03a0a25cf041e3fcb1e84a151c9aeea5a%2Faws-dx-dxgw-1.png?alt=media" alt=""><figcaption><p>Create the Direct Connect gateway</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-7318983e9d27ecbf9bcc2a2f6fe5f096878f3748%2Faws-dx-dxgw-2.png?alt=media" alt=""><figcaption><p>Name the DXGW and set its ASN</p></figcaption></figure>
{% endstep %}

{% step %}
**Attach the VPC to the VGW**

Attach the virtual private gateway you created to the target VPC, so that VPC traffic has a way onto the connection.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-8c1975d47c5531028840fd47ddd11d7ea533ae78%2Faws-dx-vpc-vgw-1.png?alt=media" alt=""><figcaption><p>Attach the VPC to the virtual private gateway</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-e2c40625273a36aa58bc2f54be2f2ae4c0dc099a%2Faws-dx-vpc-vgw-2.png?alt=media" alt=""><figcaption><p>Select the VPC to attach</p></figcaption></figure>

<img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-5961bea9ac389c1aa2f03164b5622f10a99895e1%2FIcon.svg?alt=media&amp;token=b85eac46-fd05-4800-aa2b-8db408b8af26" alt="" data-size="line"><mark style="color:blue;">**Note**</mark>\ <mark style="color:blue;">Routes the VGW learns over the connection are not added to the VPC route table automatically. Enable route propagation on that route table, or add a static route whose next hop is the VGW.</mark>
{% endstep %}

{% step %}
**Associate the DXGW with the VGW**

On the Direct Connect page, go to **Virtual private gateways** > **Direct Connect gateway associations** and associate the VGW with the Direct Connect gateway you created.

If you leave **Allowed Prefixes** empty, the whole VPC CIDR associated with that Direct Connect is advertised. You can also list the prefixes to advertise on-premises, but avoid advertising host routes (`/32`).

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-164aaf9c318decb3eb738ee91ceae87a16364b06%2Faws-dx-dxgw-association-1.png?alt=media" alt=""><figcaption><p>Associate the Direct Connect gateway with the VGW</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-665ea30194e1f55b2a640609cf96a7d65a3282ab%2Faws-dx-dxgw-association-2.png?alt=media" alt=""><figcaption><p>Set the allowed prefixes</p></figcaption></figure>
{% endstep %}

{% step %}
**Accept the hosted connection**

Once you confirm the Direct Connect location, VLAN ID, and bandwidth, Zenlayer requests an AWS hosted connection for your account. Sign in to the AWS Management Console, review it on the Direct Connect **Connections** page, and **accept** it. About 3 minutes later you can create virtual interfaces under that hosted connection.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-08c8cba66d7027e9d8e1d18a7644646edebf895e%2Faws-dx-hosted-connection-1.png?alt=media" alt=""><figcaption><p>Review the pending hosted connection on the Connections page</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-3fb5e68bae576f55150b18e67557e8aa7830bdb0%2Faws-dx-hosted-connection-2.png?alt=media" alt=""><figcaption><p>Accept the hosted connection</p></figcaption></figure>

<img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-5961bea9ac389c1aa2f03164b5622f10a99895e1%2FIcon.svg?alt=media&amp;token=b85eac46-fd05-4800-aa2b-8db408b8af26" alt="" data-size="line"><mark style="color:blue;">**Note**</mark>\ <mark style="color:blue;">Accepting the hosted connection starts the AWS port-hour charges for the bandwidth tier you chose. When you change or terminate the service, delete the hosted connection as well so it stops billing. See</mark> [<mark style="color:purple;">**AWS Direct Connect pricing**</mark>](https://aws.amazon.com/directconnect/pricing/)<mark style="color:blue;">.</mark>
{% endstep %}

{% step %}
**Create the VIF and bring up BGP peering**

Once the hosted connection is available, create a **Private VIF** or a **Transit VIF** to match your architecture, and configure:

* **BGP ASN**: the ASN of your on-premises router. The Zenlayer-side ASN is `62610`.
* **BGP peer IPs**: the addresses on both ends of the BGP session.
* **BGP authentication key** (optional): a password that secures the BGP session.

AWS takes about 5 minutes to create it. Once the VIF is available, BGP peering with your device comes up and routes start to be exchanged.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-135d8148d081c57a627f23fa017ca91f76af51c8%2Faws-dx-vif-1.png?alt=media" alt=""><figcaption><p>Create the virtual interface</p></figcaption></figure>

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-6cb6af82994117b1bc31774b67a7e774a8af20f4%2Faws-dx-vif-2.png?alt=media" alt=""><figcaption><p>The VIF is created and BGP peering is up</p></figcaption></figure>
{% endstep %}

{% step %}
**Configure your on-premises router**

Configure the same BGP settings on your router as on the VIF. Once the session is up, check both route tables: your router should learn the routes AWS advertises, and AWS should learn the prefixes you advertise.

<figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fgit-blob-34756c3315de586727130b5b85909274a6e9038d%2Faws-dx-router-bgp.png?alt=media" alt=""><figcaption><p>The BGP session on the on-premises router</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## References

* [**AWS Direct Connect FAQs**](https://aws.amazon.com/directconnect/faqs/)
* [**AWS Direct Connect pricing**](https://aws.amazon.com/directconnect/pricing/)
* [**Create a virtual interface**](https://docs.aws.amazon.com/directconnect/latest/UserGuide/create-vif.html)
