Skip to content
v2.278.0

ClientVpnEndpointProps Struct ​

Properties for a client VPN endpoint.

Example ​

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

declare const clientVpnConnectionHandler: ec2.IClientVpnConnectionHandler;
declare const clientVpnUserBasedAuthentication: ec2.ClientVpnUserBasedAuthentication;
declare const logGroupRef: interfaces_logs.ILogGroupRef;
declare const logStreamRef: interfaces_logs.ILogStreamRef;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const clientVpnEndpointProps: ec2.ClientVpnEndpointProps = {
  cidr: 'cidr',
  serverCertificateArn: 'serverCertificateArn',
  vpc: vpc,

  // the properties below are optional
  authorizeAllUsersToVpcCidr: false,
  clientCertificateArn: 'clientCertificateArn',
  clientConnectionHandler: clientVpnConnectionHandler,
  clientLoginBanner: 'clientLoginBanner',
  clientRouteEnforcementOptions: {
    enforced: false,
  },
  description: 'description',
  disconnectOnSessionTimeout: false,
  dnsServers: ['dnsServers'],
  logging: false,
  logGroup: logGroupRef,
  logStream: logStreamRef,
  port: ec2.VpnPort.HTTPS,
  securityGroups: [securityGroup],
  selfServicePortal: false,
  sessionTimeout: ec2.ClientVpnSessionTimeout.EIGHT_HOURS,
  splitTunnel: false,
  transportProtocol: ec2.TransportProtocol.TCP,
  userBasedAuthentication: clientVpnUserBasedAuthentication,
  vpcSubnets: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2
from aws_cdk.interfaces import aws_logs as interfaces_logs

# client_vpn_connection_handler: ec2.IClientVpnConnectionHandler
# client_vpn_user_based_authentication: ec2.ClientVpnUserBasedAuthentication
# log_group_ref: interfaces_logs.ILogGroupRef
# log_stream_ref: interfaces_logs.ILogStreamRef
# security_group: ec2.SecurityGroup
# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc

client_vpn_endpoint_props = ec2.ClientVpnEndpointProps(
    cidr="cidr",
    server_certificate_arn="serverCertificateArn",
    vpc=vpc,

    # the properties below are optional
    authorize_all_users_to_vpc_cidr=False,
    client_certificate_arn="clientCertificateArn",
    client_connection_handler=client_vpn_connection_handler,
    client_login_banner="clientLoginBanner",
    client_route_enforcement_options=ec2.ClientRouteEnforcementOptions(
        enforced=False
    ),
    description="description",
    disconnect_on_session_timeout=False,
    dns_servers=["dnsServers"],
    logging=False,
    log_group=log_group_ref,
    log_stream=log_stream_ref,
    port=ec2.VpnPort.HTTPS,
    security_groups=[security_group],
    self_service_portal=False,
    session_timeout=ec2.ClientVpnSessionTimeout.EIGHT_HOURS,
    split_tunnel=False,
    transport_protocol=ec2.TransportProtocol.TCP,
    user_based_authentication=client_vpn_user_based_authentication,
    vpc_subnets=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.interfaces.logs.*;

IClientVpnConnectionHandler clientVpnConnectionHandler;
ClientVpnUserBasedAuthentication clientVpnUserBasedAuthentication;
ILogGroupRef logGroupRef;
ILogStreamRef logStreamRef;
SecurityGroup securityGroup;
Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

ClientVpnEndpointProps clientVpnEndpointProps = ClientVpnEndpointProps.builder()
        .cidr("cidr")
        .serverCertificateArn("serverCertificateArn")
        .vpc(vpc)

        // the properties below are optional
        .authorizeAllUsersToVpcCidr(false)
        .clientCertificateArn("clientCertificateArn")
        .clientConnectionHandler(clientVpnConnectionHandler)
        .clientLoginBanner("clientLoginBanner")
        .clientRouteEnforcementOptions(ClientRouteEnforcementOptions.builder()
                .enforced(false)
                .build())
        .description("description")
        .disconnectOnSessionTimeout(false)
        .dnsServers(List.of("dnsServers"))
        .logging(false)
        .logGroup(logGroupRef)
        .logStream(logStreamRef)
        .port(VpnPort.HTTPS)
        .securityGroups(List.of(securityGroup))
        .selfServicePortal(false)
        .sessionTimeout(ClientVpnSessionTimeout.EIGHT_HOURS)
        .splitTunnel(false)
        .transportProtocol(TransportProtocol.TCP)
        .userBasedAuthentication(clientVpnUserBasedAuthentication)
        .vpcSubnets(SubnetSelection.builder()
                .availabilityZones(List.of("availabilityZones"))
                .onePerAz(false)
                .subnetFilters(List.of(subnetFilter))
                .subnetGroupName("subnetGroupName")
                .subnets(List.of(subnet))
                .subnetType(SubnetType.PRIVATE_ISOLATED)
                .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.AWS.EC2;
using Amazon.CDK.Interfaces.Logs;

IClientVpnConnectionHandler clientVpnConnectionHandler;
ClientVpnUserBasedAuthentication clientVpnUserBasedAuthentication;
ILogGroupRef logGroupRef;
ILogStreamRef logStreamRef;
SecurityGroup securityGroup;
Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

var clientVpnEndpointProps = new ClientVpnEndpointProps {
    Cidr = "cidr",
    ServerCertificateArn = "serverCertificateArn",
    Vpc = vpc,

    // the properties below are optional
    AuthorizeAllUsersToVpcCidr = false,
    ClientCertificateArn = "clientCertificateArn",
    ClientConnectionHandler = clientVpnConnectionHandler,
    ClientLoginBanner = "clientLoginBanner",
    ClientRouteEnforcementOptions = new ClientRouteEnforcementOptions {
        Enforced = false
    },
    Description = "description",
    DisconnectOnSessionTimeout = false,
    DnsServers = new [] { "dnsServers" },
    Logging = false,
    LogGroup = logGroupRef,
    LogStream = logStreamRef,
    Port = VpnPort.HTTPS,
    SecurityGroups = new [] { securityGroup },
    SelfServicePortal = false,
    SessionTimeout = ClientVpnSessionTimeout.EIGHT_HOURS,
    SplitTunnel = false,
    TransportProtocol = TransportProtocol.TCP,
    UserBasedAuthentication = clientVpnUserBasedAuthentication,
    VpcSubnets = new SubnetSelection {
        AvailabilityZones = new [] { "availabilityZones" },
        OnePerAz = false,
        SubnetFilters = new [] { subnetFilter },
        SubnetGroupName = "subnetGroupName",
        Subnets = new [] { subnet },
        SubnetType = SubnetType.PRIVATE_ISOLATED
    }
};
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 "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var clientVpnConnectionHandler IClientVpnConnectionHandler
var clientVpnUserBasedAuthentication ClientVpnUserBasedAuthentication
var logGroupRef ILogGroupRef
var logStreamRef ILogStreamRef
var securityGroup SecurityGroup
var subnet Subnet
var subnetFilter SubnetFilter
var vpc Vpc

clientVpnEndpointProps := &ClientVpnEndpointProps{
	Cidr: jsii.String("cidr"),
	ServerCertificateArn: jsii.String("serverCertificateArn"),
	Vpc: vpc,

	// the properties below are optional
	AuthorizeAllUsersToVpcCidr: jsii.Boolean(false),
	ClientCertificateArn: jsii.String("clientCertificateArn"),
	ClientConnectionHandler: clientVpnConnectionHandler,
	ClientLoginBanner: jsii.String("clientLoginBanner"),
	ClientRouteEnforcementOptions: &ClientRouteEnforcementOptions{
		Enforced: jsii.Boolean(false),
	},
	Description: jsii.String("description"),
	DisconnectOnSessionTimeout: jsii.Boolean(false),
	DnsServers: []*string{
		jsii.String("dnsServers"),
	},
	Logging: jsii.Boolean(false),
	LogGroup: logGroupRef,
	LogStream: logStreamRef,
	Port: awscdk.Aws_ec2.VpnPort_HTTPS,
	SecurityGroups: []ISecurityGroup{
		securityGroup,
	},
	SelfServicePortal: jsii.Boolean(false),
	SessionTimeout: awscdk.*Aws_ec2.ClientVpnSessionTimeout_EIGHT_HOURS,
	SplitTunnel: jsii.Boolean(false),
	TransportProtocol: awscdk.*Aws_ec2.TransportProtocol_TCP,
	UserBasedAuthentication: clientVpnUserBasedAuthentication,
	VpcSubnets: &SubnetSelection{
		AvailabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		OnePerAz: jsii.Boolean(false),
		SubnetFilters: []SubnetFilter{
			subnetFilter,
		},
		SubnetGroupName: jsii.String("subnetGroupName"),
		Subnets: []ISubnet{
			subnet,
		},
		SubnetType: awscdk.*Aws_ec2.SubnetType_PRIVATE_ISOLATED,
	},
}

Properties ​

authorizeAllUsersToVpcCidroptionalbooleanauthorize_all_users_to_vpc_cidroptionalboolauthorizeAllUsersToVpcCidroptionalBooleanAuthorizeAllUsersToVpcCidroptionalboolAuthorizeAllUsersToVpcCidroptional*bool = true #
Whether to authorize all users to the VPC CIDR.

This automatically creates an authorization rule. Set this to false and use addAuthorizationRule() to create your own rules instead.

cidrstringcidrstrcidrStringCidrstringCidr*string required #
The IPv4 address range, in CIDR notation, from which to assign client IP addresses.
notes

The address range cannot overlap with the local CIDR of the VPC in which the associated subnet is located, or the routes that you add manually.

Changing the address range will replace the Client VPN endpoint.

The CIDR block should be /22 or greater.

clientCertificateArnoptionalstringclient_certificate_arnoptionalstrclientCertificateArnoptionalStringClientCertificateArnoptionalstringClientCertificateArnoptional*string #
The ARN of the client certificate for mutual authentication.

Default: use user-based authentication

The certificate must be signed by a certificate authority (CA) and it must be provisioned in AWS Certificate Manager (ACM).

clientConnectionHandleroptionalIClientVpnConnectionHandlerclient_connection_handleroptionalIClientVpnConnectionHandlerclientConnectionHandleroptionalIClientVpnConnectionHandlerClientConnectionHandleroptionalIClientVpnConnectionHandlerClientConnectionHandleroptionalIClientVpnConnectionHandler #
The AWS Lambda function used for connection authorization.

Default: no connection handler

The name of the Lambda function must begin with the AWSClientVPN- prefix

clientLoginBanneroptionalstringclient_login_banneroptionalstrclientLoginBanneroptionalStringClientLoginBanneroptionalstringClientLoginBanneroptional*string #
Customizable text that will be displayed in a banner on AWS provided clients when a VPN session is established.

Default: no banner is presented to the client

UTF-8 encoded characters only. Maximum of 1400 characters.

clientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsclient_route_enforcement_optionsoptionalClientRouteEnforcementOptionsclientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsClientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsClientRouteEnforcementOptionsoptionalClientRouteEnforcementOptions #
Options for Client Route Enforcement.

Default: undefined - AWS Client VPN default setting is disable client route enforcement

notes

Client Route Enforcement is a feature of Client VPN that helps enforce administrator defined routes on devices connected through the VPN. This feature helps improve your security posture by ensuring that network traffic originating from a connected client is not inadvertently sent outside the VPN tunnel.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
A brief description of the Client VPN endpoint.

Default: no description

disconnectOnSessionTimeoutoptionalbooleandisconnect_on_session_timeoutoptionalbooldisconnectOnSessionTimeoutoptionalBooleanDisconnectOnSessionTimeoutoptionalboolDisconnectOnSessionTimeoutoptional*bool #
Indicates whether the client VPN session is disconnected after the maximum `sessionTimeout` is reached.

Default: undefined - AWS Client VPN default is true

If true, users are prompted to reconnect client VPN. If false, client VPN attempts to reconnect automatically.

dnsServersoptionalstring[]dns_serversoptionaltyping.List[str]dnsServersoptionalList<String>DnsServersoptionalstring[]DnsServersoptional*[]*string #
Information about the DNS servers to be used for DNS resolution.

Default: use the DNS address configured on the device

A Client VPN endpoint can have up to two DNS servers.

loggingoptionalbooleanloggingoptionalboolloggingoptionalBooleanLoggingoptionalboolLoggingoptional*bool = true #
Whether to enable connections logging.
logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef #
A CloudWatch Logs log group for connection logging.

Default: a new group is created

logStreamoptionalILogStreamReflog_streamoptionalILogStreamReflogStreamoptionalILogStreamRefLogStreamoptionalILogStreamRefLogStreamoptionalILogStreamRef #
A CloudWatch Logs log stream for connection logging.

Default: a new stream is created

portoptionalVpnPortportoptionalVpnPortportoptionalVpnPortPortoptionalVpnPortPortoptionalVpnPort = VpnPort.HTTPS #
The port number to assign to the Client VPN endpoint for TCP and UDP traffic.
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup #
The security groups to apply to the target network.

Default: a new security group is created

selfServicePortaloptionalbooleanself_service_portaloptionalboolselfServicePortaloptionalBooleanSelfServicePortaloptionalboolSelfServicePortaloptional*bool = true #
Specify whether to enable the self-service portal for the Client VPN endpoint.
serverCertificateArnstringserver_certificate_arnstrserverCertificateArnStringServerCertificateArnstringServerCertificateArn*string required #
The ARN of the server certificate.
sessionTimeoutoptionalClientVpnSessionTimeoutsession_timeoutoptionalClientVpnSessionTimeoutsessionTimeoutoptionalClientVpnSessionTimeoutSessionTimeoutoptionalClientVpnSessionTimeoutSessionTimeoutoptionalClientVpnSessionTimeout #
The maximum VPN session duration time.

Default: ClientVpnSessionTimeout.TWENTY_FOUR_HOURS

splitTunneloptionalbooleansplit_tunneloptionalboolsplitTunneloptionalBooleanSplitTunneloptionalboolSplitTunneloptional*bool = false #
Indicates whether split-tunnel is enabled on the AWS Client VPN endpoint.
transportProtocoloptionalTransportProtocoltransport_protocoloptionalTransportProtocoltransportProtocoloptionalTransportProtocolTransportProtocoloptionalTransportProtocolTransportProtocoloptionalTransportProtocol = TransportProtocol.UDP #
The transport protocol to be used by the VPN session.
userBasedAuthenticationoptionalClientVpnUserBasedAuthenticationuser_based_authenticationoptionalClientVpnUserBasedAuthenticationuserBasedAuthenticationoptionalClientVpnUserBasedAuthenticationUserBasedAuthenticationoptionalClientVpnUserBasedAuthenticationUserBasedAuthenticationoptionalClientVpnUserBasedAuthentication #
The type of user-based authentication to use.

Default: use mutual authentication

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc required #
The VPC to connect to.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection #
Subnets to associate to the client VPN endpoint.

Default: the VPC default strategy