-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ec2): client vpn endpoint (#12234)
Add support for client VPN endpoints with the following L2s: `ClientVpnEndpoint`, `ClientVpnAuthorizationRule` and `ClientVpnRoute`. Client VPN endpoints can be added to VPCs with the `addClientVpnEndpoint()` method. Both mutual and user-based authentication are supported. The `ClientVpnEndpoint` class implements `IConnectable`. Use a custom resource to import server and client certificates in ACM for the integration test. Close #4206 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
19 changed files
with
1,964 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/@aws-cdk/aws-ec2/lib/client-vpn-authorization-rule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Resource } from '@aws-cdk/core'; | ||
import { Construct } from 'constructs'; | ||
import { IClientVpnEndpoint } from './client-vpn-endpoint-types'; | ||
import { CfnClientVpnAuthorizationRule } from './ec2.generated'; | ||
|
||
/** | ||
* Options for a ClientVpnAuthorizationRule | ||
*/ | ||
export interface ClientVpnAuthorizationRuleOptions { | ||
/** | ||
* The IPv4 address range, in CIDR notation, of the network for which access | ||
* is being authorized. | ||
*/ | ||
readonly cidr: string; | ||
|
||
/** | ||
* The ID of the group to grant access to, for example, the Active Directory | ||
* group or identity provider (IdP) group. | ||
* | ||
* @default - authorize all groups | ||
*/ | ||
readonly groupId?: string; | ||
|
||
/** | ||
* A brief description of the authorization rule. | ||
* | ||
* @default - no description | ||
*/ | ||
readonly description?: string; | ||
} | ||
|
||
/** | ||
* Properties for a ClientVpnAuthorizationRule | ||
*/ | ||
export interface ClientVpnAuthorizationRuleProps extends ClientVpnAuthorizationRuleOptions { | ||
/** | ||
* The client VPN endpoint to which to add the rule. | ||
*/ | ||
readonly clientVpnEndoint: IClientVpnEndpoint; | ||
} | ||
|
||
/** | ||
* A client VPN authorization rule | ||
*/ | ||
export class ClientVpnAuthorizationRule extends Resource { | ||
constructor(scope: Construct, id: string, props: ClientVpnAuthorizationRuleProps) { | ||
super(scope, id); | ||
|
||
new CfnClientVpnAuthorizationRule(this, 'Resource', { | ||
clientVpnEndpointId: props.clientVpnEndoint.endpointId, | ||
targetNetworkCidr: props.cidr, | ||
accessGroupId: props.groupId, | ||
authorizeAllGroups: !props.groupId, | ||
description: props.description, | ||
}); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint-types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { IDependable, IResource } from '@aws-cdk/core'; | ||
import { IConnectable } from './connections'; | ||
|
||
/** | ||
* A client VPN endpoint | ||
*/ | ||
export interface IClientVpnEndpoint extends IResource, IConnectable { | ||
/** | ||
* The endpoint ID | ||
*/ | ||
readonly endpointId: string; | ||
|
||
/** | ||
* Dependable that can be depended upon to force target networks associations | ||
*/ | ||
readonly targetNetworksAssociated: IDependable; | ||
} | ||
|
||
/** | ||
* A connection handler for client VPN endpoints | ||
*/ | ||
export interface IClientVpnConnectionHandler { | ||
/** | ||
* The name of the function | ||
*/ | ||
readonly functionName: string; | ||
|
||
/** | ||
* The ARN of the function. | ||
*/ | ||
readonly functionArn: string; | ||
} | ||
|
||
/** | ||
* Transport protocol for client VPN | ||
*/ | ||
export enum TransportProtocol { | ||
/** Transmission Control Protocol (TCP) */ | ||
TCP = 'tcp', | ||
/** User Datagram Protocol (UDP) */ | ||
UDP = 'udp', | ||
} | ||
|
||
/** | ||
* Port for client VPN | ||
*/ | ||
export enum VpnPort { | ||
/** HTTPS */ | ||
HTTPS = 443, | ||
/** OpenVPN */ | ||
OPENVPN = 1194, | ||
} |
Oops, something went wrong.