AWS Amazon EC2 Client VPN Authorization Rule
This page shows how to write Terraform and CloudFormation for Amazon EC2 Client VPN Authorization Rule and write them securely.
aws_ec2_client_vpn_authorization_rule (Terraform)
The Client VPN Authorization Rule in Amazon EC2 can be configured in Terraform with the resource name aws_ec2_client_vpn_authorization_rule
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_ec2_client_vpn_authorization_rule" "vpn_auth_rule" {
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id
target_network_cidr = module.vpc.vpc_cidr_block
authorize_all_groups = true
Parameters
-
access_group_id
optional - string -
authorize_all_groups
optional - bool -
client_vpn_endpoint_id
required - string -
description
optional - string -
id
optional computed - string -
target_network_cidr
required - string
Explanation in Terraform Registry
Provides authorization rules 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.
aws_default_vpc
Ensure to avoid using default VPC
It is better to define the own VPC and use it.
aws_network_acl_rule
Ensure your network ACL rule blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
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).
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.
aws_security_group
Ensure your security group blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
AWS::EC2::ClientVpnAuthorizationRule (CloudFormation)
The ClientVpnAuthorizationRule in EC2 can be configured in CloudFormation with the resource name AWS::EC2::ClientVpnAuthorizationRule
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::EC2::ClientVpnAuthorizationRule
Condition: RoutePeered
Properties:
# AccessGroupId: String
AuthorizeAllGroups: true
ClientVpnEndpointId: !Ref ClientVPN
Type: AWS::EC2::ClientVpnAuthorizationRule
Properties:
AuthorizeAllGroups: true
ClientVpnEndpointId: !Ref ClientVpnEndpoint
TargetNetworkCidr: !GetAtt Vpc.CidrBlock
Type: AWS::EC2::ClientVpnAuthorizationRule
Properties:
AuthorizeAllGroups: true
ClientVpnEndpointId:
Ref: ClientVPNEndpoint
Description: Authorization rule for clients to access internet
Type: AWS::EC2::ClientVpnAuthorizationRule
Properties:
AuthorizeAllGroups: True
ClientVpnEndpointId: !Ref VPNEndpoint
Description: To VPC
TargetNetworkCidr: !GetAtt VPNVPC.CidrBlock
Type: "AWS::EC2::ClientVpnAuthorizationRule"
Properties:
ClientVpnEndpointId: !Ref VPNEndpoint
AccessGroupId: PermitVLAN1
TargetNetworkCidr: "10.1.0.0/16"
Description: "PermitVLAN1 to 10.1.0.0/16"
"Type" : "AWS::EC2::ClientVpnAuthorizationRule",
"Properties" : {
"AuthorizeAllGroups": "true",
"ClientVpnEndpointId": {"Ref": "clientVpnEndpointId"},
"Description": "authorize-client-vpn-ingress",
"TargetNetworkCidr": {"Ref": "targetNetworkCidr"}
"Type": "AWS::EC2::ClientVpnAuthorizationRule",
"Properties": {
"ClientVpnEndpointId": {
"Ref": "VpcEndpoint6FF034F6"
},
"TargetNetworkCidr": {
"Type": "AWS::EC2::ClientVpnAuthorizationRule",
"Properties": {
"ClientVpnEndpointId": {
"Ref": "clientVpnEndpoint5E60766B"
},
"TargetNetworkCidr": {
"Type": "AWS::EC2::ClientVpnAuthorizationRule",
"Properties": {
"ClientVpnEndpointId": {
"Ref": "EC2CVE11MMM"
},
"TargetNetworkCidr": "0.0.0.0/0",
"AWS::EC2::ClientVpnAuthorizationRule": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html",
"Properties": {
"ClientVpnEndpointId": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-clientvpnendpointid",
Parameters
-
ClientVpnEndpointId
required - String -
Description
optional - String -
AccessGroupId
optional - String -
TargetNetworkCidr
required - String -
AuthorizeAllGroups
optional - Boolean
Explanation in CloudFormation Registry
Specifies an ingress authorization rule to add to a Client VPN endpoint. Ingress authorization rules act as firewall rules that grant access to networks. You must configure ingress authorization rules to enable clients to access resources in AWS or on-premises networks.
Frequently asked questions
What is AWS Amazon EC2 Client VPN Authorization Rule?
AWS Amazon EC2 Client VPN Authorization Rule 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 Authorization Rule?
For Terraform, the cisagov/inl-aws source code example is useful. See the Terraform Example section for further details.
For CloudFormation, the CU-CommunityApps/cu-aws-cloudformation, agibalov/aws-experiment and bayustira/TemplateCloudFormationYAML source code examples are useful. See the CloudFormation Example section for further details.