# VpnTunnelOption

- Source: [`aws-ec2/lib/vpn.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/vpn.ts#L55)
- Type last changed: v2.21.0 · 22 Apr 2022

## Example

TypeScript:

```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;
const vpnTunnelOption: ec2.VpnTunnelOption = {
  preSharedKey: 'preSharedKey',
  preSharedKeySecret: secretValue,
  tunnelInsideCidr: 'tunnelInsideCidr',
};
```

Python:

```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

vpn_tunnel_option = ec2.VpnTunnelOption(
    pre_shared_key="preSharedKey",
    pre_shared_key_secret=secret_value,
    tunnel_inside_cidr="tunnelInsideCidr"
)
```

Java:

```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;

VpnTunnelOption vpnTunnelOption = VpnTunnelOption.builder()
        .preSharedKey("preSharedKey")
        .preSharedKeySecret(secretValue)
        .tunnelInsideCidr("tunnelInsideCidr")
        .build();
```

C# / .NET:

```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;

var vpnTunnelOption = new VpnTunnelOption {
    PreSharedKey = "preSharedKey",
    PreSharedKeySecret = secretValue,
    TunnelInsideCidr = "tunnelInsideCidr"
};
```

Golang:

```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

vpnTunnelOption := &VpnTunnelOption{
	PreSharedKey: jsii.String("preSharedKey"),
	PreSharedKeySecret: secretValue,
	TunnelInsideCidr: jsii.String("tunnelInsideCidr"),
}
```

## Properties

- `preSharedKey`: string — Use `preSharedKeySecret` instead

  **Default:** an Amazon generated pre-shared key

  Allowed characters are
  alphanumeric characters period `.` and underscores `_`. Must be between 8
  and 64 characters in length and cannot start with zero (0).

- `preSharedKeySecret`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) — The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway.

  **Default:** an Amazon generated pre-shared key

  Allowed characters are
  alphanumeric characters period `.` and underscores `_`. Must be between 8
  and 64 characters in length and cannot start with zero (0).

- `tunnelInsideCidr`: string — The range of inside IP addresses for the tunnel.

  **Default:** an Amazon generated inside IP CIDR

  Any specified CIDR blocks must be
  unique across all VPN connections that use the same virtual private gateway.
  A size /30 CIDR block from the 169.254.0.0/16 range.
