Skip to main content

vpn_gateways

Creates, updates, deletes, gets or lists a vpn_gateways resource.

Overview

Namevpn_gateways
TypeResource
Idaws.ec2.vpn_gateways

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
amazon_side_asnintegerThe private Autonomous System Number (ASN) for the Amazon side of a BGP session.
availability_zonestringThe Availability Zone where the virtual private gateway was created, if applicable. This field may be empty or not returned.
statestringThe current state of the virtual private gateway.
tagsstringAny tags assigned to the virtual private gateway.
typestringThe type of VPN connection the virtual private gateway supports.
vpc_attachmentsstringAny VPCs attached to the virtual private gateway.
vpn_gateway_idstringThe ID of the virtual private gateway.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_vpn_gatewaysselectregionFilter, VpnGatewayId, DryRunDescribes one or more of your virtual private gateways. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.
create_vpn_gatewayinsertregionAvailabilityZone, Type, TagSpecification, AmazonSideAsn, DryRunCreates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.
attach_vpn_gatewayupdateVpcId, VpnGatewayId, regionDryRunAttaches an available virtual private gateway to a VPC. You can attach one virtual private gateway to one VPC at a time. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.
delete_vpn_gatewaydeleteVpnGatewayId, regionDryRunDeletes the specified virtual private gateway. You must first detach the virtual private gateway from the VPC. Note that you don't need to delete the virtual private gateway if you plan to delete and recreate the VPN connection between your VPC and your network.
detach_vpn_gatewayexecVpcId, VpnGatewayId, regionDryRunDetaches a virtual private gateway from a VPC. You do this if you're planning to turn off the VPC and not use it anymore. You can confirm a virtual private gateway has been completely detached from a VPC by describing the virtual private gateway (any attachments to the virtual private gateway are also described). You must wait for the attachment's state to switch to detached before you can delete the VPC or attach a different VPC to the virtual private gateway.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
VpcIdstringThe ID of the VPC.
VpnGatewayIdstringThe ID of the virtual private gateway.
regionstringAWS region (default: us-east-1)
AmazonSideAsninteger (int64)A private Autonomous System Number (ASN) for the Amazon side of a BGP session. If you're using a 16-bit ASN, it must be in the 64512 to 65534 range. If you're using a 32-bit ASN, it must be in the 4200000000 to 4294967294 range. Default: 64512
AvailabilityZonestringThe Availability Zone for the virtual private gateway.
DryRunbooleanChecks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
FilterarrayOne or more filters. amazon-side-asn - The Autonomous System Number (ASN) for the Amazon side of the gateway. attachment.state - The current state of the attachment between the gateway and the VPC (attaching | attached | detaching | detached). attachment.vpc-id - The ID of an attached VPC. availability-zone - The Availability Zone for the virtual private gateway (if applicable). state - The state of the virtual private gateway (pending | available | deleting | deleted). tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value. tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value. type - The type of virtual private gateway. Currently the only supported type is ipsec.1. vpn-gateway-id - The ID of the virtual private gateway.
TagSpecificationarrayThe tags to apply to the virtual private gateway.
TypestringThe type of VPN connection this virtual private gateway supports.
VpnGatewayIdarrayOne or more virtual private gateway IDs. Default: Describes all your virtual private gateways.

SELECT examples

Describes one or more of your virtual private gateways. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.

SELECT
amazon_side_asn,
availability_zone,
state,
tags,
type,
vpc_attachments,
vpn_gateway_id
FROM aws.ec2.vpn_gateways
WHERE region = '{{ region }}' -- required
AND Filter = '{{ Filter }}'
AND VpnGatewayId = '{{ VpnGatewayId }}'
AND DryRun = '{{ DryRun }}'
;

INSERT examples

Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.

INSERT INTO aws.ec2.vpn_gateways (
region,
AvailabilityZone,
Type,
TagSpecification,
AmazonSideAsn,
DryRun
)
SELECT
'{{ region }}',
'{{ AvailabilityZone }}',
'{{ Type }}',
'{{ TagSpecification }}',
'{{ AmazonSideAsn }}',
'{{ DryRun }}'
RETURNING
amazon_side_asn,
availability_zone,
state,
tags,
type,
vpc_attachments,
vpn_gateway_id
;

UPDATE examples

Attaches an available virtual private gateway to a VPC. You can attach one virtual private gateway to one VPC at a time. For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.

UPDATE aws.ec2.vpn_gateways
SET
-- No updatable properties
WHERE
VpcId = '{{ VpcId }}' --required
AND VpnGatewayId = '{{ VpnGatewayId }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
RETURNING
state,
vpc_id;

DELETE examples

Deletes the specified virtual private gateway. You must first detach the virtual private gateway from the VPC. Note that you don't need to delete the virtual private gateway if you plan to delete and recreate the VPN connection between your VPC and your network.

DELETE FROM aws.ec2.vpn_gateways
WHERE VpnGatewayId = '{{ VpnGatewayId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;

Lifecycle Methods

Detaches a virtual private gateway from a VPC. You do this if you're planning to turn off the VPC and not use it anymore. You can confirm a virtual private gateway has been completely detached from a VPC by describing the virtual private gateway (any attachments to the virtual private gateway are also described). You must wait for the attachment's state to switch to detached before you can delete the VPC or attach a different VPC to the virtual private gateway.

EXEC aws.ec2.vpn_gateways.detach_vpn_gateway
@VpcId='{{ VpcId }}' --required,
@VpnGatewayId='{{ VpnGatewayId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;