> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Aviatrix Gateway to AWS Virtual Private Gateway (VGW)

> This section describes how to configure an IPsec tunnel between an Aviatrix Gateway and an AWS VGW.

This section describes how to configure an IPsec tunnel between an Aviatrix
Gateway and an AWS VGW.

<img src="https://mintcdn.com/aviatrix-14b37c43/Gre8pdluiL7JmlpL/images/guides/connectivity/vpn/gw-to-vgw.png?fit=max&auto=format&n=Gre8pdluiL7JmlpL&q=85&s=ef4d3ee9e5471bb8e01c2f2560e6c819" alt="gw2vgw" width="732" height="482" data-path="images/guides/connectivity/vpn/gw-to-vgw.png" />

For this use case, you will first configure the AWS VGW VPN connection, and then
download the configuration from AWS and import it into Aviatrix.

<a id="create-vpn-connection" />

## Create the Customer Gateway

<Note>
  **Prerequisites**

  1. You have a VGW created and attached to a VPC.
  2. You have an Aviatrix Gateway provisioned in a different VPC. You will need
     this gateway's public IP address for the steps below.

  You have the option of adding a High Availability (HA) instance when you create
  your Aviatrix Gateway.
</Note>

1. Log in to your [VPC Dashboard](https://console.aws.amazon.com/vpc/home) in
   the region where your VGW is located.
2. Create a new
   [Customer Gateway](https://console.aws.amazon.com/vpc/home#CreateCustomerGateway).
   In the IP address field, enter the public IP address of the Aviatrix Gateway.

   <img src="https://mintcdn.com/aviatrix-14b37c43/1zOMu4WXCFpEtXhJ/images/guides/connectivity/vpn/aws-cg.png?fit=max&auto=format&n=1zOMu4WXCFpEtXhJ&q=85&s=b8efab83f3881ef1da2ac791a93705c5" alt="awscg" width="1706" height="1438" data-path="images/guides/connectivity/vpn/aws-cg.png" />

## Create a VPN Connection

1. Create a
   [VPN Connection](https://console.aws.amazon.com/vpc/home#CreateVpnConnection:).

   <img src="https://mintcdn.com/aviatrix-14b37c43/1zOMu4WXCFpEtXhJ/images/guides/connectivity/vpn/aws-vpn.png?fit=max&auto=format&n=1zOMu4WXCFpEtXhJ&q=85&s=62744f4b9462f3910b3a64d96dd10957" alt="aws vpn connection" width="1114" height="1384" data-path="images/guides/connectivity/vpn/aws-vpn.png" />

   | Field               | Description                                                                            |
   | ------------------- | -------------------------------------------------------------------------------------- |
   | Name                | Enter any name here                                                                    |
   | Target gateway type | Select Virtual private gateway                                                         |
   | Customer Gateway    | Select **Existing** and then select the gateway you created in the previous procedure. |
   | Routing Options     | Select **Static**                                                                      |
   | Static IP Prefixes  | Enter the CIDR(s) of the VPC where the Aviatrix Gateway resides.                       |

2. You can leave the Tunnel 1 and 2 options as their defaults. Click **Create
   VPN connection**.

3. Select the VPN you just created and click **Download Configuration**.

   <img src="https://mintcdn.com/aviatrix-14b37c43/1zOMu4WXCFpEtXhJ/images/guides/connectivity/vpn/aws-download-vpn-config1.png?fit=max&auto=format&n=1zOMu4WXCFpEtXhJ&q=85&s=71c6652e82e4de69882ec18a38b457a0" alt="download vpn configuration" width="2464" height="460" data-path="images/guides/connectivity/vpn/aws-download-vpn-config1.png" />

4. At the dialog, select **Generic** for the Vendor, **Generic** for the
   Platform and **Vendor Agnostic** for the Software.

5. Click **Download**. You will use this file to create the other side of the
   tunnel.

   <img src="https://mintcdn.com/aviatrix-14b37c43/1zOMu4WXCFpEtXhJ/images/guides/connectivity/vpn/aws-download-vpn-config.png?fit=max&auto=format&n=1zOMu4WXCFpEtXhJ&q=85&s=e4bd4e7bcd7d79ad79cd37a60c8d7d7f" alt="download vpn configuration dialog" width="968" height="936" data-path="images/guides/connectivity/vpn/aws-download-vpn-config.png" />

<a id="configure-external-connection" />

## Configure the External Connection

1. Log in to CoPilot and go to Networking > Connectivity > External Connection.
2. Click **+External Connection**.
3. Follow the steps in one of these documents to create an Unmapped connection
   to an AWS TGW Remote Gateway:

* [Static Route-Based](https://legacy.docs.aviatrix.com/documentation/latest/network/external-connection-create-static-route-based-unmapped.html)
* [Static Policy-Based](https://legacy.docs.aviatrix.com/documentation/latest/network/external-connection-create-static-policy-based-unmapped.html)

<Note>
  When creating this external connection, do the following:

  * Ensure that the Algorithms checkbox is selected.
  * Select the **Generic** Remote Device Type. Any other Remote Devices listed
    here are only valid with Controller version 6.7 or lower.
</Note>

4. Enter the following values when configuring the external connection (make
   sure you have the downloaded configuration file from the previous section
   available):

* Remote Subnet CIDR(s): This is usually the the Spoke VPC that on-prem wants to
  reach (in this example, 10.20.0.0/20)
* Pre-Shared Key: Enter the value that matches the value from #1: Internet Key
  Exchange Configuration > Pre-Shared Key from the downloaded configuration file
* Remote Device IP: Enter the value that matches #3: Tunnel Interface
  Configuration > Outside IP Addresses > Virtual Private Gateway from the
  downloaded file (in this example, 3.212.183.205)

<img src="https://mintcdn.com/aviatrix-14b37c43/Gre8pdluiL7JmlpL/images/guides/connectivity/vpn/tunnel-config.png?fit=max&auto=format&n=Gre8pdluiL7JmlpL&q=85&s=5aad6a946cf7f19cd324b7e004a1d0f7" alt="tunnel configuration" width="2336" height="1380" data-path="images/guides/connectivity/vpn/tunnel-config.png" />

## Testing the Connection

Once complete, you can check the tunnel status at Diagnostics > Cloud Routes >
External Connections.

## Troubleshooting

If the tunnel does not come up within the expected time frame, you can check the
IP addresses to confirm that they are accurate.

Additional troubleshooting is available under Diagnostics > Diagnostic Tools.

## Appendix: Enable HA

You can enable HA for Aviatrix Site2Cloud connection to AWS VGW. Please add the
following extra steps to the configuration.

### Creating an Aviatrix HA Gateway

Before creating a Site2Cloud connection, make sure that you

<a href={"/docs/enterprise/" + "10.1" + "/guides/gateways/gateway-ha-about#create-ha-gateway-instance"}>add an HA instance when creating your Aviatrix Gateway</a>
.

### Creating a VPN Connection Between VGW and the Aviatrix HA Gateway

Follow the steps from
[Create the Customer Gateway](#create-the-customer-gateway) above.

The only differences are:

* When you create the Customer Gateway, enter the Aviatrix HA gateway public IP
* When you create the VPN connection:
  * Select the same VGW used for the primary VPN connection
  * Select the customer gateway you just created for HA
  * Enter the CIDR(s) of the VPC where the HA Aviatrix Gateway resides under
    Static IP Prefixes

Download the configuration for this new VPN connection just like you did earlier
for the primary VPN connection.

### Create Aviatrix Site2Cloud Connection with HA

In CoPilot, go to Networking > Connectivity > External Connections (S2C) and add
a new external connection. Add an instance for HA.

Additional fields are displayed when checked.

<Note>
  You need the information from the downloaded VPN configuration file to
  configure the external connection between the AWS VPN and the Aviatrix HA
  Gateway. Follow the same steps you did for the primary connection.
</Note>

| Field                             | Description                                                                                                                     |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Backup Gateway                    | Select the Aviatrix HA Gateway you just created                                                                                 |
| Remote Device IP Address (Backup) | Enter the value that matches the value from #3: Tunnel Interface Configuration > Outside IP Addresses > Virtual Private Gateway |
| Pre-shared Key (Backup)           | Enter the value that matches the value #1: Internet Key Exchange Configuration > Pre-Shared Key                                 |

Other fields should be filled as instructed in above section
[Configure the External Connection](#configure-the-external-connection).

## Related Topics

* [External Device Settings](https://legacy.docs.aviatrix.com/documentation/latest/network/externaldevice-settings.html)
