Use CreateVpnGateway with a CLI - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use CreateVpnGateway with a CLI

The following code examples show how to use CreateVpnGateway.

CLI
Amazon CLI

To create a virtual private gateway

This example creates a virtual private gateway.

Command:

aws ec2 create-vpn-gateway --type ipsec.1

Output:

{ "VpnGateway": { "AmazonSideAsn": 64512, "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-9a4cacf3", "VpcAttachments": [] } }

To create a virtual private gateway with a specific Amazon-side ASN

This example creates a virtual private gateway and specifies the Autonomous System Number (ASN) for the Amazon side of the BGP session.

Command:

aws ec2 create-vpn-gateway --type ipsec.1 --amazon-side-asn 65001

Output:

{ "VpnGateway": { "AmazonSideAsn": 65001, "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-9a4cacf3", "VpcAttachments": [] } }
PowerShell
Tools for PowerShell

Example 1: This example creates the specified virtual private gateway.

New-EC2VpnGateway -Type ipsec.1

Output:

AvailabilityZone : State : available Tags : {} Type : ipsec.1 VpcAttachments : {} VpnGatewayId : vgw-1a2b3c4d
  • For API details, see CreateVpnGateway in Amazon Tools for PowerShell Cmdlet Reference.

For a complete list of Amazon SDK developer guides and code examples, see Create Amazon EC2 resources using an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.