Skip to content
v2.277.0

VpnConnectionProps Struct ​

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const secretValue: cdk.SecretValue;
declare const vpc: ec2.Vpc;
const vpnConnectionProps: ec2.VpnConnectionProps = {
  ip: 'ip',
  vpc: vpc,

  // the properties below are optional
  asn: 123,
  staticRoutes: ['staticRoutes'],
  tunnelOptions: [{
    preSharedKey: 'preSharedKey',
    preSharedKeySecret: secretValue,
    tunnelInsideCidr: 'tunnelInsideCidr',
  }],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2

# secret_value: cdk.SecretValue
# vpc: ec2.Vpc

vpn_connection_props = ec2.VpnConnectionProps(
    ip="ip",
    vpc=vpc,

    # the properties below are optional
    asn=123,
    static_routes=["staticRoutes"],
    tunnel_options=[ec2.VpnTunnelOption(
        pre_shared_key="preSharedKey",
        pre_shared_key_secret=secret_value,
        tunnel_inside_cidr="tunnelInsideCidr"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ec2.*;

SecretValue secretValue;
Vpc vpc;

VpnConnectionProps vpnConnectionProps = VpnConnectionProps.builder()
        .ip("ip")
        .vpc(vpc)

        // the properties below are optional
        .asn(123)
        .staticRoutes(List.of("staticRoutes"))
        .tunnelOptions(List.of(VpnTunnelOption.builder()
                .preSharedKey("preSharedKey")
                .preSharedKeySecret(secretValue)
                .tunnelInsideCidr("tunnelInsideCidr")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;

SecretValue secretValue;
Vpc vpc;

var vpnConnectionProps = new VpnConnectionProps {
    Ip = "ip",
    Vpc = vpc,

    // the properties below are optional
    Asn = 123,
    StaticRoutes = new [] { "staticRoutes" },
    TunnelOptions = new [] { new VpnTunnelOption {
        PreSharedKey = "preSharedKey",
        PreSharedKeySecret = secretValue,
        TunnelInsideCidr = "tunnelInsideCidr"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var secretValue SecretValue
var vpc Vpc

vpnConnectionProps := &VpnConnectionProps{
	Ip: jsii.String("ip"),
	Vpc: vpc,

	// the properties below are optional
	Asn: jsii.Number(123),
	StaticRoutes: []*string{
		jsii.String("staticRoutes"),
	},
	TunnelOptions: []VpnTunnelOption{
		&VpnTunnelOption{
			PreSharedKey: jsii.String("preSharedKey"),
			PreSharedKeySecret: secretValue,
			TunnelInsideCidr: jsii.String("tunnelInsideCidr"),
		},
	},
}

Properties ​

asnoptionalnumberasnoptionalint | floatasnoptionalNumberAsnoptionaldoubleAsnoptional*float64= 65000#
The ASN of the customer gateway.
ipstringipstripStringIpstringIp*stringrequired#
The ip address of the customer gateway.
staticRoutesoptionalstring[]static_routesoptionaltyping.List[str]staticRoutesoptionalList<String>StaticRoutesoptionalstring[]StaticRoutesoptional*[]*string#
The static routes to be routed from the VPN gateway to the customer gateway.

Default: Dynamic routing (BGP)

tunnelOptionsoptionalVpnTunnelOption[]tunnel_optionsoptionaltyping.List[VpnTunnelOption]tunnelOptionsoptionalList<VpnTunnelOption>TunnelOptionsoptionalVpnTunnelOption[]TunnelOptionsoptional*[]VpnTunnelOption#
The tunnel options for the VPN connection.

Default: Amazon generated tunnel options

At most two elements (one per tunnel). Duplicates not allowed.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC to connect to.