Use DescribeVpnGateways with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeVpnGateways with an AWS SDK or CLI

The following code examples show how to use DescribeVpnGateways.

CLI
AWS CLI

To describe your virtual private gateways

This example describes your virtual private gateways.

Command:

aws ec2 describe-vpn-gateways

Output:

{ "VpnGateways": [ { "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-f211f09b", "VpcAttachments": [ { "State": "attached", "VpcId": "vpc-98eb5ef5" } ] }, { "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-9a4cacf3", "VpcAttachments": [ { "State": "attaching", "VpcId": "vpc-a01106c2" } ] } ] }
PowerShell
Tools for PowerShell

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

Get-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d

Output:

AvailabilityZone : State : available Tags : {} Type : ipsec.1 VpcAttachments : {vpc-12345678} VpnGatewayId : vgw-1a2b3c4d

Example 2: This example describes any virtual private gateway whose state is either pending or available.

$filter = New-Object Amazon.EC2.Model.Filter $filter.Name = "state" $filter.Values = @( "pending", "available" ) Get-EC2VpnGateway -Filter $filter

Example 3: This example describes all your virtual private gateways.

Get-EC2VpnGateway