Linking a Virtual Gateway

You can link a virtual gateway to a Net. You can then set up a VPN connection between the Net and a client gateway. For more information, see Tutorial: Setting Up a VPN Connection.

This action updates the attachment state of the virtual gateway from detached to attached, while the virtual gateway remains in the available state. For more information, see About Virtual Private Gateways > Lifecycle.

You can link each virtual gateway to one Net only at a time. You can link a virtual gateway to a Net before or after creating the VPN connection. For more information, see Creating a VPN Connection.

Linking a Virtual Gateway Using Cockpit v2

Before you begin:

  1. Click inside the Virtual Gateways dashboard to make checkboxes appear.

  2. Check the box of the virtual gateway you want to link to a Net.
    The virtual gateway is selected and an action menu appears.

  3. Click IconLink Link to Net.
    The LINK TO NET dialog box appears.

  4. From the Net list, select the ID of the Net to which you want to link the virtual gateway.

  5. Click Link.
    The virtual gateway is linked to the specified Net.

Linking a Virtual Gateway Using OSC CLI

Before you begin:

The LinkVirtualGateway command attaches a virtual gateway to a Net.

This action can be done only if the virtual gateway is in the available state.

Request sample
$ osc-cli api LinkVirtualGateway --profile "default" \
    --VirtualGatewayId "vgw-12345678" \
    --NetId "vpc-12345678"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NetId: The ID of the Net to which you want to attach the virtual gateway.

  • VirtualGatewayId: The ID of the virtual gateway.

The LinkVirtualGateway command returns the following elements:

  • NetToVirtualGatewayLink: Information about the attachment.

  • ResponseContext: Information about the context of the response.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "NetToVirtualGatewayLink": {
    "State": "attached",
    "NetId": "vpc-12345678"
  }
}

Attaching a Virtual Private Gateway Using AWS CLI

Before you begin:

To attach a virtual private gateway to a VPC, use the attach-vpn-gateway command following this syntax:

Request sample
$ aws ec2 attach-vpn-gateway \
    --profile YOU_PROFILE \
    --vpn-gateway-id vgw-00ac2c82 \
    --vpc-id vpc-eb1e7306 \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • vpn-gateway-id: The ID of the virtual private gateway you want to attach.

  • vpc-id: The ID of the VPC you want to attach the virtual private gateway to.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The attach-vpn-gateway command returns the following elements:

  • State: The state of the attachment (attaching | attached | detaching | detached). For more information, see About Virtual Gateways.

  • VpcId: The ID of the VPC to which the virtual private gateway is attached.

Result sample
{
    "VpcAttachment": {
        "State": "attached",
        "VpcId": "vpc-eb1e7306"
    }
}

The virtual private gateway is attached to the specified VPC.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.