AWS Amazon EC2 Client VPN Network Association

This page shows how to write Terraform and CloudFormation for Amazon EC2 Client VPN Network Association and write them securely.

aws_ec2_client_vpn_network_association (Terraform)

The Client VPN Network Association in Amazon EC2 can be configured in Terraform with the resource name aws_ec2_client_vpn_network_association. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides network associations for AWS Client VPN endpoints. For more information on usage, please see the AWS Client VPN Administrator's Guide.

Tips: Best Practices for The Other AWS Amazon EC2 Resources

In addition to the aws_default_vpc, AWS Amazon EC2 has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_default_vpc

Ensure to avoid using default VPC

It is better to define the own VPC and use it.

risk-label

aws_network_acl_rule

Ensure your network ACL rule blocks unwanted inbound traffic

It is better to block unwanted inbound traffic.

risk-label

aws_ebs_volume

Ensure to use a customer-managed key for EBS volume encryption

It is better to use a customer-managed key for EBS volume encryption. It can be gain more control over the encryption by using customer-managed keys (CMK).

risk-label

aws_instance

Ensure to avoid storing AWS access keys in user data

It is better to avoid storing AWS access keys in user data. `aws_iam_instance_profile` could be used instead.

risk-label

aws_security_group

Ensure your security group blocks unwanted inbound traffic

It is better to block unwanted inbound traffic.

Review your AWS Amazon EC2 settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::EC2::ClientVpnTargetNetworkAssociation (CloudFormation)

The ClientVpnTargetNetworkAssociation in EC2 can be configured in CloudFormation with the resource name AWS::EC2::ClientVpnTargetNetworkAssociation. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

Scenario-2-G.yml#L85
    Type: AWS::EC2::ClientVpnTargetNetworkAssociation
    Properties:
      ClientVpnEndpointId:
        Ref: ClientVPNEndpoint
      SubnetId:
        Fn::ImportValue:
create-clientvpn-cfn.yml#L79
    Type: "AWS::EC2::ClientVpnTargetNetworkAssociation"
    Properties:
      ClientVpnEndpointId: !Ref "ClientVpnEndpoint"
      SubnetId:
        Ref: "SubnetID1"
  NetworkAssociation2:
client-vpn.yml#L72
    Type: AWS::EC2::ClientVpnTargetNetworkAssociation
    Properties:
      ClientVpnEndpointId: !Ref ClientVPN
      SubnetId: !Select [ 0, !Ref PrivateSubnetIds ]

  TargetNetwork2:
vpc-vpn.yml#L169
    Type: AWS::EC2::ClientVpnTargetNetworkAssociation
    Properties:
      ClientVpnEndpointId: !Ref ClientVPN
      SubnetId: !Ref subnetToAssociate1

  ClientVPNAssociation2:
client-vpn.yml#L156
    Type: AWS::EC2::ClientVpnTargetNetworkAssociation
    Properties:
      ClientVpnEndpointId: !Ref ClientVpn
      SubnetId: !Ref PublicSubnet
  PrivateSubnetNetworkAssociation:
    Type: AWS::EC2::ClientVpnTargetNetworkAssociation
integ.client-vpn-endpoint.expected.json#L541
      "Type": "AWS::EC2::ClientVpnTargetNetworkAssociation",
      "Properties": {
        "ClientVpnEndpointId": {
          "Ref": "VpcEndpoint6FF034F6"
        },
        "SubnetId": {
integ.client-vpn-endpoint.expected.json#L541
      "Type": "AWS::EC2::ClientVpnTargetNetworkAssociation",
      "Properties": {
        "ClientVpnEndpointId": {
          "Ref": "VpcEndpoint6FF034F6"
        },
        "SubnetId": {
integ.client-vpn-endpoint.expected.json#L541
      "Type": "AWS::EC2::ClientVpnTargetNetworkAssociation",
      "Properties": {
        "ClientVpnEndpointId": {
          "Ref": "VpcEndpoint6FF034F6"
        },
        "SubnetId": {
integ.client-vpn-endpoint.expected.json#L541
      "Type": "AWS::EC2::ClientVpnTargetNetworkAssociation",
      "Properties": {
        "ClientVpnEndpointId": {
          "Ref": "VpcEndpoint6FF034F6"
        },
        "SubnetId": {
EC2ClientVpnTargetNetworkAssociationSpecification.json#L3
    "AWS::EC2::ClientVpnTargetNetworkAssociation": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html",
      "Properties": {
        "ClientVpnEndpointId": {
          "Required": true,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html#cfn-ec2-clientvpntargetnetworkassociation-clientvpnendpointid",

Parameters

Explanation in CloudFormation Registry

Specifies a target network to associate with a Client VPN endpoint. A target network is a subnet in a VPC. You can associate multiple subnets from the same VPC with a Client VPN endpoint. You can associate only one subnet in each Availability Zone. We recommend that you associate at least two subnets to provide Availability Zone redundancy.

Frequently asked questions

What is AWS Amazon EC2 Client VPN Network Association?

AWS Amazon EC2 Client VPN Network Association is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 Client VPN Network Association?

For CloudFormation, the bayustira/TemplateCloudFormationYAML, noname-work/aws-cloudformation and webscale-oy-open-source/client-vpn-templates source code examples are useful. See the CloudFormation Example section for further details.