# VpnConnectionOptions

Used as argument in: [IVpc.addVpnConnection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html#addvpnconnection)

- 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#L87)

## Example

TypeScript:

```ts
// Across all tunnels in the account/region
const allDataOut = ec2.VpnConnection.metricAllTunnelDataOut();

// For a specific vpn connection
const vpnConnection = vpc.addVpnConnection('Dynamic', {
  ip: '1.2.3.4'
});
const state = vpnConnection.metricTunnelState();
```

Python:

```python
# Across all tunnels in the account/region
all_data_out = ec2.VpnConnection.metric_all_tunnel_data_out()

# For a specific vpn connection
vpn_connection = vpc.add_vpn_connection("Dynamic",
    ip="1.2.3.4"
)
state = vpn_connection.metric_tunnel_state()
```

Java:

```java
// Across all tunnels in the account/region
Metric allDataOut = VpnConnection.metricAllTunnelDataOut();

// For a specific vpn connection
VpnConnection vpnConnection = vpc.addVpnConnection("Dynamic", VpnConnectionOptions.builder()
        .ip("1.2.3.4")
        .build());
Metric state = vpnConnection.metricTunnelState();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// Across all tunnels in the account/region
var allDataOut = VpnConnection.MetricAllTunnelDataOut();

// For a specific vpn connection
var vpnConnection = vpc.AddVpnConnection("Dynamic", new VpnConnectionOptions {
    Ip = "1.2.3.4"
});
var state = vpnConnection.MetricTunnelState();
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Across all tunnels in the account/region
allDataOut := ec2.VpnConnection_MetricAllTunnelDataOut()

// For a specific vpn connection
vpnConnection := vpc.addVpnConnection(jsii.String("Dynamic"), &VpnConnectionOptions{
	Ip: jsii.String("1.2.3.4"),
})
state := vpnConnection.metricTunnelState()
```

## Properties

- `asn`: number = 65000 — The ASN of the customer gateway.

- `ip`: string (required) — The ip address of the customer gateway.

- `staticRoutes`: string[] — The static routes to be routed from the VPN gateway to the customer gateway.

  **Default:** Dynamic routing (BGP)

- `tunnelOptions`: [VpnTunnelOption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpnTunnelOption.html)[] — The tunnel options for the VPN connection.

  **Default:** Amazon generated tunnel options

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