VpnConnection

class VpnConnection : KotlinCustomResource

Manages a Site-to-Site VPN connection. A Site-to-Site VPN connection is an Internet Protocol security (IPsec) VPN connection between a VPC and an on-premises network. Any new Site-to-Site VPN connection that you create is an AWS VPN connection.

Note: The CIDR blocks in the arguments tunnel1_inside_cidr and tunnel2_inside_cidr must have a prefix of /30 and be a part of a specific range. Read more about this in the AWS documentation.

Example Usage

EC2 Transit Gateway

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.TransitGateway;
import com.pulumi.aws.ec2.CustomerGateway;
import com.pulumi.aws.ec2.CustomerGatewayArgs;
import com.pulumi.aws.ec2.VpnConnection;
import com.pulumi.aws.ec2.VpnConnectionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleTransitGateway = new TransitGateway("exampleTransitGateway");
var exampleCustomerGateway = new CustomerGateway("exampleCustomerGateway", CustomerGatewayArgs.builder()
.bgpAsn(65000)
.ipAddress("172.0.0.1")
.type("ipsec.1")
.build());
var exampleVpnConnection = new VpnConnection("exampleVpnConnection", VpnConnectionArgs.builder()
.customerGatewayId(exampleCustomerGateway.id())
.transitGatewayId(exampleTransitGateway.id())
.type(exampleCustomerGateway.type())
.build());
}
}

Virtual Private Gateway

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.VpnGateway;
import com.pulumi.aws.ec2.VpnGatewayArgs;
import com.pulumi.aws.ec2.CustomerGateway;
import com.pulumi.aws.ec2.CustomerGatewayArgs;
import com.pulumi.aws.ec2.VpnConnection;
import com.pulumi.aws.ec2.VpnConnectionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var vpnGateway = new VpnGateway("vpnGateway", VpnGatewayArgs.builder()
.vpcId(vpc.id())
.build());
var customerGateway = new CustomerGateway("customerGateway", CustomerGatewayArgs.builder()
.bgpAsn(65000)
.ipAddress("172.0.0.1")
.type("ipsec.1")
.build());
var main = new VpnConnection("main", VpnConnectionArgs.builder()
.vpnGatewayId(vpnGateway.id())
.customerGatewayId(customerGateway.id())
.type("ipsec.1")
.staticRoutesOnly(true)
.build());
}
}

AWS Site to Site Private VPN

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.directconnect.Gateway;
import com.pulumi.aws.directconnect.GatewayArgs;
import com.pulumi.aws.ec2transitgateway.TransitGateway;
import com.pulumi.aws.ec2transitgateway.TransitGatewayArgs;
import com.pulumi.aws.ec2.CustomerGateway;
import com.pulumi.aws.ec2.CustomerGatewayArgs;
import com.pulumi.aws.directconnect.GatewayAssociation;
import com.pulumi.aws.directconnect.GatewayAssociationArgs;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetDirectConnectGatewayAttachmentArgs;
import com.pulumi.aws.ec2.VpnConnection;
import com.pulumi.aws.ec2.VpnConnectionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleGateway = new Gateway("exampleGateway", GatewayArgs.builder()
.amazonSideAsn("64512")
.build());
var exampleTransitGateway = new TransitGateway("exampleTransitGateway", TransitGatewayArgs.builder()
.amazonSideAsn("64513")
.description("example_ipsec_vpn_example")
.transitGatewayCidrBlocks("10.0.0.0/24")
.build());
var exampleCustomerGateway = new CustomerGateway("exampleCustomerGateway", CustomerGatewayArgs.builder()
.bgpAsn(64514)
.ipAddress("10.0.0.1")
.type("ipsec.1")
.tags(Map.of("Name", "example_ipsec_vpn_example"))
.build());
var exampleGatewayAssociation = new GatewayAssociation("exampleGatewayAssociation", GatewayAssociationArgs.builder()
.dxGatewayId(exampleGateway.id())
.associatedGatewayId(exampleTransitGateway.id())
.allowedPrefixes("10.0.0.0/8")
.build());
final var exampleDirectConnectGatewayAttachment = Ec2transitgatewayFunctions.getDirectConnectGatewayAttachment(GetDirectConnectGatewayAttachmentArgs.builder()
.transitGatewayId(exampleTransitGateway.id())
.dxGatewayId(exampleGateway.id())
.build());
var exampleVpnConnection = new VpnConnection("exampleVpnConnection", VpnConnectionArgs.builder()
.customerGatewayId(exampleCustomerGateway.id())
.outsideIpAddressType("PrivateIpv4")
.transitGatewayId(exampleTransitGateway.id())
.transportTransitGatewayAttachmentId(exampleDirectConnectGatewayAttachment.applyValue(getDirectConnectGatewayAttachmentResult -> getDirectConnectGatewayAttachmentResult).applyValue(exampleDirectConnectGatewayAttachment -> exampleDirectConnectGatewayAttachment.applyValue(getDirectConnectGatewayAttachmentResult -> getDirectConnectGatewayAttachmentResult.id())))
.type("ipsec.1")
.tags(Map.of("Name", "example_ipsec_vpn_example"))
.build());
}
}

Import

VPN Connections can be imported using the vpn connection id, e.g.,

$ pulumi import aws:ec2/vpnConnection:VpnConnection testvpnconnection vpn-40f41529

Properties

Link copied to clipboard
val arn: Output<String>

Amazon Resource Name (ARN) of the VPN Connection.

Link copied to clipboard
val coreNetworkArn: Output<String>

The ARN of the core network.

Link copied to clipboard

The ARN of the core network attachment.

Link copied to clipboard

The configuration information for the VPN connection's customer gateway (in the native XML format).

Link copied to clipboard

The ID of the customer gateway.

Link copied to clipboard

Indicate whether to enable acceleration for the VPN connection. Supports only EC2 Transit Gateway.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection.

Link copied to clipboard

The IPv6 CIDR on the customer gateway (on-premises) side of the VPN connection.

Link copied to clipboard

Indicates if a Public S2S VPN or Private S2S VPN over AWS Direct Connect. Valid values are PublicIpv4 | PrivateIpv4

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The IPv4 CIDR on the AWS side of the VPN connection.

Link copied to clipboard

The IPv6 CIDR on the customer gateway (on-premises) side of the VPN connection.

Link copied to clipboard

The static routes associated with the VPN connection. Detailed below.

Link copied to clipboard

Whether the VPN connection uses static routes exclusively. Static routes must be used for devices that don't support BGP.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Tags to apply to the connection. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard

When associated with an EC2 Transit Gateway (transit_gateway_id argument), the attachment ID. See also the aws.ec2.Tag resource for tagging the EC2 Transit Gateway VPN Attachment.

Link copied to clipboard
val transitGatewayId: Output<String>?

The ID of the EC2 Transit Gateway.

Link copied to clipboard

. The attachment ID of the Transit Gateway attachment to Direct Connect Gateway. The ID is obtained through a data source only.

Link copied to clipboard
val tunnel1Address: Output<String>

The public IP address of the first VPN tunnel.

Link copied to clipboard
val tunnel1BgpAsn: Output<String>

The bgp asn number of the first VPN tunnel.

Link copied to clipboard
val tunnel1BgpHoldtime: Output<Int>

The bgp holdtime of the first VPN tunnel.

Link copied to clipboard

The RFC 6890 link-local address of the first VPN tunnel (Customer Gateway Side).

Link copied to clipboard

The action to take after DPD timeout occurs for the first VPN tunnel. Specify restart to restart the IKE initiation. Specify clear to end the IKE session. Valid values are clear | none | restart.

Link copied to clipboard

The number of seconds after which a DPD timeout occurs for the first VPN tunnel. Valid value is equal or higher than 30.

Link copied to clipboard

Turn on or off tunnel endpoint lifecycle control feature for the first VPN tunnel. Valid values are true | false.

Link copied to clipboard

The IKE versions that are permitted for the first VPN tunnel. Valid values are ikev1 | ikev2.

Link copied to clipboard

The CIDR block of the inside IP addresses for the first VPN tunnel. Valid value is a size /30 CIDR block from the 169.254.0.0/16 range.

Link copied to clipboard

The range of inside IPv6 addresses for the first VPN tunnel. Supports only EC2 Transit Gateway. Valid value is a size /126 CIDR block from the local fd00::/8 range.

Link copied to clipboard

Options for logging VPN tunnel activity. See Log Options below for more details.

Link copied to clipboard

List of one or more Diffie-Hellman group numbers that are permitted for the first VPN tunnel for phase 1 IKE negotiations. Valid values are 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24.

Link copied to clipboard

List of one or more encryption algorithms that are permitted for the first VPN tunnel for phase 1 IKE negotiations. Valid values are AES128 | AES256 | AES128-GCM-16 | AES256-GCM-16.

Link copied to clipboard

One or more integrity algorithms that are permitted for the first VPN tunnel for phase 1 IKE negotiations. Valid values are SHA1 | SHA2-256 | SHA2-384 | SHA2-512.

Link copied to clipboard

The lifetime for phase 1 of the IKE negotiation for the first VPN tunnel, in seconds. Valid value is between 900 and 28800.

Link copied to clipboard

List of one or more Diffie-Hellman group numbers that are permitted for the first VPN tunnel for phase 2 IKE negotiations. Valid values are 2 | 5 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24.

Link copied to clipboard

List of one or more encryption algorithms that are permitted for the first VPN tunnel for phase 2 IKE negotiations. Valid values are AES128 | AES256 | AES128-GCM-16 | AES256-GCM-16.

Link copied to clipboard

List of one or more integrity algorithms that are permitted for the first VPN tunnel for phase 2 IKE negotiations. Valid values are SHA1 | SHA2-256 | SHA2-384 | SHA2-512.

Link copied to clipboard

The lifetime for phase 2 of the IKE negotiation for the first VPN tunnel, in seconds. Valid value is between 900 and 3600.

Link copied to clipboard

The preshared key of the first VPN tunnel. The preshared key must be between 8 and 64 characters in length and cannot start with zero(0). Allowed characters are alphanumeric characters, periods(.) and underscores(_).

Link copied to clipboard

The percentage of the rekey window for the first VPN tunnel (determined by tunnel1_rekey_margin_time_seconds) during which the rekey time is randomly selected. Valid value is between 0 and 100.

Link copied to clipboard

The margin time, in seconds, before the phase 2 lifetime expires, during which the AWS side of the first VPN connection performs an IKE rekey. The exact time of the rekey is randomly selected based on the value for tunnel1_rekey_fuzz_percentage. Valid value is between 60 and half of tunnel1_phase2_lifetime_seconds.

Link copied to clipboard

The number of packets in an IKE replay window for the first VPN tunnel. Valid value is between 64 and 2048.

Link copied to clipboard

The action to take when the establishing the tunnel for the first VPN connection. By default, your customer gateway device must initiate the IKE negotiation and bring up the tunnel. Specify start for AWS to initiate the IKE negotiation. Valid values are add | start.

Link copied to clipboard

The RFC 6890 link-local address of the first VPN tunnel (VPN Gateway Side).

Link copied to clipboard
val tunnel2Address: Output<String>

The public IP address of the second VPN tunnel.

Link copied to clipboard
val tunnel2BgpAsn: Output<String>

The bgp asn number of the second VPN tunnel.

Link copied to clipboard
val tunnel2BgpHoldtime: Output<Int>

The bgp holdtime of the second VPN tunnel.

Link copied to clipboard

The RFC 6890 link-local address of the second VPN tunnel (Customer Gateway Side).

Link copied to clipboard

The action to take after DPD timeout occurs for the second VPN tunnel. Specify restart to restart the IKE initiation. Specify clear to end the IKE session. Valid values are clear | none | restart.

Link copied to clipboard

The number of seconds after which a DPD timeout occurs for the second VPN tunnel. Valid value is equal or higher than 30.

Link copied to clipboard

Turn on or off tunnel endpoint lifecycle control feature for the second VPN tunnel. Valid values are true | false.

Link copied to clipboard

The IKE versions that are permitted for the second VPN tunnel. Valid values are ikev1 | ikev2.

Link copied to clipboard

The CIDR block of the inside IP addresses for the second VPN tunnel. Valid value is a size /30 CIDR block from the 169.254.0.0/16 range.

Link copied to clipboard

The range of inside IPv6 addresses for the second VPN tunnel. Supports only EC2 Transit Gateway. Valid value is a size /126 CIDR block from the local fd00::/8 range.

Link copied to clipboard

Options for logging VPN tunnel activity. See Log Options below for more details.

Link copied to clipboard

List of one or more Diffie-Hellman group numbers that are permitted for the second VPN tunnel for phase 1 IKE negotiations. Valid values are 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24.

Link copied to clipboard

List of one or more encryption algorithms that are permitted for the second VPN tunnel for phase 1 IKE negotiations. Valid values are AES128 | AES256 | AES128-GCM-16 | AES256-GCM-16.

Link copied to clipboard

One or more integrity algorithms that are permitted for the second VPN tunnel for phase 1 IKE negotiations. Valid values are SHA1 | SHA2-256 | SHA2-384 | SHA2-512.

Link copied to clipboard

The lifetime for phase 1 of the IKE negotiation for the second VPN tunnel, in seconds. Valid value is between 900 and 28800.

Link copied to clipboard

List of one or more Diffie-Hellman group numbers that are permitted for the second VPN tunnel for phase 2 IKE negotiations. Valid values are 2 | 5 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24.

Link copied to clipboard

List of one or more encryption algorithms that are permitted for the second VPN tunnel for phase 2 IKE negotiations. Valid values are AES128 | AES256 | AES128-GCM-16 | AES256-GCM-16.

Link copied to clipboard

List of one or more integrity algorithms that are permitted for the second VPN tunnel for phase 2 IKE negotiations. Valid values are SHA1 | SHA2-256 | SHA2-384 | SHA2-512.

Link copied to clipboard

The lifetime for phase 2 of the IKE negotiation for the second VPN tunnel, in seconds. Valid value is between 900 and 3600.

Link copied to clipboard

The preshared key of the second VPN tunnel. The preshared key must be between 8 and 64 characters in length and cannot start with zero(0). Allowed characters are alphanumeric characters, periods(.) and underscores(_).

Link copied to clipboard

The percentage of the rekey window for the second VPN tunnel (determined by tunnel2_rekey_margin_time_seconds) during which the rekey time is randomly selected. Valid value is between 0 and 100.

Link copied to clipboard

The margin time, in seconds, before the phase 2 lifetime expires, during which the AWS side of the second VPN connection performs an IKE rekey. The exact time of the rekey is randomly selected based on the value for tunnel2_rekey_fuzz_percentage. Valid value is between 60 and half of tunnel2_phase2_lifetime_seconds.

Link copied to clipboard

The number of packets in an IKE replay window for the second VPN tunnel. Valid value is between 64 and 2048.

Link copied to clipboard

The action to take when the establishing the tunnel for the second VPN connection. By default, your customer gateway device must initiate the IKE negotiation and bring up the tunnel. Specify start for AWS to initiate the IKE negotiation. Valid values are add | start.

Link copied to clipboard

The RFC 6890 link-local address of the second VPN tunnel (VPN Gateway Side).

Link copied to clipboard

Indicate whether the VPN tunnels process IPv4 or IPv6 traffic. Valid values are ipv4 | ipv6. ipv6 Supports only EC2 Transit Gateway.

Link copied to clipboard
val type: Output<String>

The type of VPN connection. The only type AWS supports at this time is "ipsec.1".

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

Telemetry for the VPN tunnels. Detailed below.

Link copied to clipboard
val vpnGatewayId: Output<String>?

The ID of the Virtual Private Gateway.