Challenges encountered while configuring AWS Client VPN and the insights gained along the way
This post discusses security group configurations and ENIs—insights gained after encountering connection issues with AWS Client VPN.
Engineer
Introduction
I recently ran into trouble while trying to connect my home PC (running Ubuntu 24.04) to an Amazon EC2 instance—configured with the open-source proxy "Squid"—using AWS Client VPN.
This experience prompted me to take a closer look at security group configurations and Elastic Network Interfaces (ENI); in this post, I will share some of the insights I gained.
This article reflects the author’s personal views. While I have thoroughly verified that the information provided works as intended, please let me know if you spot any errors.
Scope
What will be covered
- The story behind the challenges encountered while configuring Client VPN
- The rationale behind security group configurations
- An explanation of what an ENI (Elastic Network Interface) resource is
What will not be covered
- Step-by-step instructions for configuring AWS Client VPN
- Detailed configuration settings for the EC2 instances and VPCs used in this environment
- Information regarding Squid
What is AWS Client VPN?
AWS Client VPN (hereinafter referred to as "Client VPN") is a managed, client-based VPN service that enables secure access to AWS resources from on-premises environments.
Key advantages include:
- The ability to build a VPN connection environment without the operational overhead of managing hardware.
- Support for dynamic scaling.
Key Challenges Encountered
Proposed Architecture
As shown in the diagram below, the plan was to establish a VPN connection from a PC and verify internet access by routing traffic through an EC2 instance configured with the open-source proxy software "Squid."

Security Group Configuration
The security group for the Client VPN (Security group ①) and the security group for the EC2 instance (Security group ②) have been configured as follows.

Outbound rules for Security Group ①
Destination | Protocol | Port |
|---|---|---|
10.0.0.0/16 | TCP | 3128 |
Inbound rules for Security Group ②
Source | Protocol | Port | Notes |
|---|---|---|---|
10.1.0.0/22 | TCP | 3128 | IP address range for Client VPN |
Unable to establish VPN connection
Although I set up and configured the system as described above, I was unable to establish a VPN connection.

Cause
There was an error in the security group configuration.
The Client VPN endpoint performs SNAT (Source Network Address Translation) on IP addresses.
When a Client VPN endpoint is created, a Client VPN network interface (ENI) is automatically provisioned within the destination subnet. Traffic originating from the Client VPN endpoint passes through this ENI, where Source Network Address Translation (SNAT) is applied, replacing the source address with a private IP address from the target subnet. Consequently, the IP address of the VPN endpoint as perceived by an EC2 instance is the IP address of the Client VPN network interface.
For the inbound rules of the EC2 security group (Security Group ①), you must specify either the IP address range of the subnet to which it belongs or the security group ID of the Client VPN endpoint as the source.
Therefore, you need to modify the source for the inbound rules.
Inbound Rules (After Modification)
Source | Protocol | Port |
|---|---|---|
10.0.0.0/24 | TCP | 3128 |
After this modification, the VPN connection was successfully established, enabling internet access via the EC2 instance.
While this configuration allows for communication, defining access based on an IP address range is too broad. Even if communication is possible, it cannot be considered secure.
Key Observations
Security Groups Are Attached to Client VPN Network Interfaces
When a Client VPN is created, an Elastic Network Interface (ENI) is provisioned. This ENI is associated with the same security group(s) as those attached to the Client VPN itself.
More precisely, IP addresses and security groups are not attached directly to resources like a Client VPN or an EC2 instance; rather, they are attached to the ENI.
With this understanding, one might have been able to infer the potential cause behind a failure to establish a VPN connection.
What Exactly Is an ENI?
An ENI (Elastic Network Interface) acts as a virtual network interface card (NIC) that connects AWS resources within a network. ENIs are automatically created in the background whenever resources such as EC2 instances, RDS databases, or endpoints are provisioned. This also occurs when a Client VPN endpoint is created.
IP addresses and security groups are configured on the ENI, not on the Client VPN endpoint or the EC2 instance itself.
You might not often think about ENIs—I certainly didn’t. However, this experience has served as a strong reminder that they are crucial resources for connecting AWS resources via a network. I intend to explore the topic of ENIs in greater depth.
Use Security Groups as Sources/Destinations in Security Group Rules
Allowing access based on IP address ranges carries the risk of inadvertently permitting traffic from unintended resources.
If a security group is attached to a Client VPN network interface, you can restrict access by specifying another security group as the source.
With this adjustment, the configuration becomes as follows:
Inbound Rules (After Revision)
Source | Protocol | Port |
|---|---|---|
Security Group ID of the Client VPN network interface | TCP | 3128 |
Additionally, I updated the outbound rules for the Client VPN’s security group (Security Group ②) to allow traffic specifically from the EC2 instance’s security group (Security Group ②), rather than permitting access from an entire IP address range.
Outbound Rules (After Revision)
Source | Protocol | Port |
|---|---|---|
Security Group ID of the EC2 instance | TCP | 3128 |
Following these changes, the VPN connection was successfully established, enabling internet access via the EC2 instance. The actual network path is summarized below:

To maintain network security, I believe it is crucial to design systems that allow for source and destination restrictions via security groups, rather than relying on designs that necessitate granting broad access across entire IP address ranges.
Conclusion
Building a Client VPN from scratch provided a great opportunity to explore security group configurations and ENIs (Elastic Network Interfaces), leading to many valuable insights and lessons.
I later discovered that there is a hands-on guide for Client VPN, which also mentions that IP addresses are subject to SNAT (Source Network Address Translation). If you are planning to set up a Client VPN, I highly recommend working through this hands-on guide first.
I hope this article proves helpful in some way. Thank you for reading to the end!
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article