Client VPN

A managed OpenVPN endpoint that puts a single user's laptop onto your private network in AWS — and, from there, anywhere the VPC can reach. It is the mirror of Site-to-Site VPN: that joins networks, this joins one machine.

Một endpoint OpenVPN được quản lý, đưa laptop của một người dùng vào mạng riêng của bạn trong AWS — và từ đó, tới bất cứ đâu VPC với tới được. Nó là bản đối chiếu của Site-to-Site VPN: cái kia nối mạng với mạng, cái này nối một máy.

The whole trick: the endpoint drops ENIs into a subnet, and once traffic is on that ENI it routes like any other VPC traffic. So the interesting questions are all about reach — peered VPCs, on-prem over the VPN, other VPCs via Transit Gateway, and the internet.

Toàn bộ mấu chốt: endpoint thả ENI vào một subnet, và khi traffic đã nằm trên ENI đó thì nó định tuyến như mọi traffic khác trong VPC. Nên câu hỏi thú vị đều xoay quanh chuyện với tới đâu — VPC đã peer, on-prem qua VPN, VPC khác qua Transit Gateway, và internet.

Client VPN is the right answer when… / reach for something else when…Khi nào chọn Client VPN… / khi nào dùng thứ khác…

Use Client VPNDùng Client VPN

  • Individual people on laptops — staff, contractors — need to reach private resources in a VPC.Từng người trên laptop — nhân viên, contractor — cần với tới tài nguyên private trong VPC.
  • You want to retire a self-managed OpenVPN server for a managed, highly available endpoint.Muốn bỏ một server OpenVPN tự quản để dùng một endpoint được quản lý, có sẵn tính sẵn sàng cao.
  • Users must also reach on-premises or other VPCs through AWS, not just the one VPC.Người dùng còn phải với tới on-premises hoặc VPC khác qua AWS, chứ không chỉ một VPC.
  • You need per-group access control — this team gets these subnets, that contractor gets one.Cần phân quyền theo nhóm — nhóm này được các subnet này, contractor kia chỉ được một cái.

Reach for something elseChuyển sang thứ khác

  • Connecting a whole site / data centre network → Site-to-Site VPN.Nối cả một site / data center → Site-to-Site VPN.
  • Joining two VPCs to each other → peering or Transit Gateway, not a client VPN.Nối hai VPC với nhau → peering hoặc Transit Gateway, không phải client VPN.
  • Exposing one service to consumers → PrivateLink.Mở một service cho bên tiêu dùng → PrivateLink.
  • Admin shell into a private instance with no VPN at all → Session Manager (Systems Manager).Cần shell quản trị vào một instance private mà không cần VPN → Session Manager (Systems Manager).

The shape — an endpoint that puts an ENI in your subnetHình dạng — một endpoint thả ENI vào subnet của bạn

The user runs an OpenVPN client, connects to the Client VPN Endpoint, and is handed a private IP. AWS terminates that at a Client VPN ENI inside a subnet you chose. After that hop, the packet is just VPC traffic from a private address — everything else on this page is about where that traffic is then allowed to go. Người dùng chạy client OpenVPN, kết nối tới Client VPN Endpoint, và được cấp một IP private. AWS kết thúc nó tại một Client VPN ENI nằm trong subnet bạn chọn. Sau chặng đó, gói tin chỉ là traffic VPC xuất phát từ một địa chỉ private — phần còn lại của trang này nói về chuyện traffic đó được phép đi tới đâu.

The basic Client VPN shape. On the left, a client laptop running an OpenVPN client connects to a managed AWS Client VPN Endpoint. That endpoint terminates in a private subnet of VPC-A on 172.31.0.0/16, at a Client VPN ENI with the private address 172.31.4.104. From that ENI, traffic routes like any other VPC traffic, so it can reach AWS resources and, beyond them, peered VPCs and on-premises. The laptop receives a private IP on the network; this is a user-to-network connection, the mirror of Site-to-Site VPN's network-to-network. one laptop → a managed endpoint → an ENI in your subnet Client OpenVPN AWS Client VPN Endpoint managed · OpenVPN VPC-A · 172.31.0.0/16 private subnet · 172.31.0.0/20 Client VPN ENI 172.31.4.104 from here it routes like any VPC traffic the laptop gets a private IP on your network user-to-network — the mirror of Site-to-Site VPN's network-to-network

Once you see the ENI, the service stops being mysterious: everything past it is ordinary VPC routing. The endpoint is the only managed piece; the reach is just route tables plus authorization rules.

Khi đã thấy cái ENI thì service hết bí ẩn: mọi thứ sau nó là định tuyến VPC bình thường. Endpoint là mảnh duy nhất được quản lý; còn với tới đâu chỉ là route table cộng authorization rule.

What the endpoint attaches to — two layersEndpoint gắn vào đâu — hai lớp At creation you pick an association type: VPC (attach to one VPC by its ID, with a security group on the endpoint), Transit Gateway (a hub to many VPCs, no peering needed), or None (configure it later). That is the endpoint's network attachment. Then, as a second layer, you associate target subnet(s) — and each subnet association is where AWS places a Client VPN ENI (one per AZ, so associate two AZs for HA). So "attach the endpoint to a VPC/TGW" and "associate subnets for the ENIs" are two different steps. Lúc tạo, bạn chọn association type: VPC (gắn vào một VPC theo VPC ID, kèm security group đặt trên endpoint), Transit Gateway (một hub tới nhiều VPC, khỏi cần peering), hoặc None (cấu hình sau). Đó là chỗ endpoint bám vào mạng. Sau đó, ở lớp thứ hai, bạn associate (các) target subnet — và mỗi lần associate subnet là nơi AWS đặt một Client VPN ENI (mỗi AZ một cái, nên gắn hai AZ cho sẵn sàng cao). Vậy "gắn endpoint vào VPC/TGW" và "associate subnet để có ENI" là hai bước khác nhau.
The endpoint has its own route tableEndpoint có route table riêng của nó Separate from the VPC's route tables, the Client VPN Endpoint carries its own route table. Associating a subnet auto-adds one route — the CIDR of that subnet's VPC. To reach anything else — a peered VPC, on-premises, another VPC via Transit Gateway, or 0.0.0.0/0 for the internet — you add a route yourself: destination CIDR → the associated subnet (the target). No route on the endpoint, and those packets have nowhere to go. Tách biệt với route table của VPC, Client VPN Endpoint có route table riêng. Gắn một subnet vào là AWS tự thêm một route — chính dải CIDR của VPC chứa subnet đó. Muốn tới bất cứ thứ gì khác — một VPC đã peer, on-premises, VPC khác qua Transit Gateway, hay 0.0.0.0/0 để ra internet — bạn phải tự thêm route: destination CIDR → subnet đã gắn (target). Thiếu route trên endpoint thì gói tin không biết đi đâu.
And an authorization rule decides who may use itVà authorization rule quyết định ai được dùng An authorization rule is an allow-list entry on the endpoint that answers "which users may reach which network": you give it a destination CIDR and who — all connected users, or a specific Active Directory / SAML group. It sits at the endpoint, separate from security groups. The endpoint starts with none, so by default a connected user reaches nothing until a rule permits it — this is how you grant a contractor one subnet and no more. Một authorization rule là một dòng allow-list trên endpoint, trả lời "user nào được với tới mạng nào": bạn khai một destination CIDR và ai — tất cả user đang kết nối, hoặc một group cụ thể trong Active Directory / SAML. Nó nằm ở endpoint, tách biệt với security group. Endpoint khởi đầu không có luật nào, nên mặc định user kết nối vào không với tới gì cả cho tới khi có luật cho phép — đây là cách cho một contractor đúng một subnet, không hơn.
Both are required, per destinationCả hai đều bắt buộc, cho từng đích A network is reachable only with both: a route (so the packet has a path) and an authorization rule (so the user is permitted). Miss the route → nowhere to go. Miss the rule → denied even though the route exists. "Connected, but can't reach subnet X" is almost always the missing authorization rule. Một mạng chỉ với tới được khi có cả hai: một route (để gói tin có đường đi) và một authorization rule (để user được phép). Thiếu route → không có đường. Thiếu luật → bị chặn dù route đã có. "Kết nối được mà không tới được subnet X" gần như luôn là thiếu authorization rule.

Reaching beyond the VPC — peering & on-premisesVới ra ngoài VPC — peering & on-premises

Because the ENI's traffic is ordinary VPC traffic, Client VPN is compatible with VPC peering and can ride the VPC's Site-to-Site VPN (or Direct Connect) to on-premises. One endpoint in one VPC, and the user reaches a peered VPC and the corporate data centre from the same session. Vì traffic của ENI là traffic VPC bình thường, Client VPN tương thích với VPC peering và đi ké được Site-to-Site VPN (hoặc Direct Connect) của VPC để tới on-premises. Một endpoint trong một VPC, người dùng với tới cả VPC đã peer lẫn data center công ty trong cùng một phiên.

Client VPN reaching beyond its own VPC. A client connects through a Client VPN Endpoint into VPC-A on 172.31.0.0/16, terminating at a Client VPN ENI at 172.31.4.104. From VPC-A, one path goes down through VPC peering to VPC-B on 10.2.0.0/16, and another path goes through a Site-to-Site VPN to the corporate data centre. So the same connected user can reach the local VPC, the peered VPC, and on-premises resources. one session reaches the VPC, a peered VPC, and on-prem Client Client VPN Endpoint VPC-A · 172.31.0.0/16 Client VPN ENI 172.31.4.104 VPC peering VPC-B 10.2.0.0/16 Site-to-Site VPN Corporate Data Center

The two links leaving VPC-A are exactly the machinery from the peering and Site-to-Site pages — Client VPN adds nothing new there, it just gets to use them. Which also means their limits apply: peering is not transitive, so a second peered VPC hanging off VPC-B is not reachable this way.

Hai đường rời VPC-A chính là bộ máy trong trang peering và Site-to-Site — Client VPN không thêm gì mới ở đó, nó chỉ được dùng chúng. Điều đó cũng nghĩa là giới hạn của chúng vẫn áp: peering không bắc cầu, nên một VPC peer thứ hai treo sau VPC-B thì kiểu này không tới được.

Internet access — the exit is the VPC's, not the laptop'sTruy cập internet — cửa ra là của VPC, không phải của laptop

To send the client's internet traffic through AWS (full-tunnel), the endpoint's ENI subnet must have a way out: a route to an Internet Gateway if the ENI sits in a public subnet, or to a NAT Gateway if it sits in a private one. Either way the traffic leaves from the VPC's egress. Để đẩy traffic internet của client xuyên qua AWS (full-tunnel), subnet của ENI phải có đường ra: route tới Internet Gateway nếu ENI nằm ở public subnet, hoặc tới NAT Gateway nếu nằm ở private subnet. Kiểu nào thì traffic cũng ra từ cửa của VPC.

Two ways Client VPN gives internet access. Row one: users connect through AWS Client VPN to a Client VPN ENI in a public subnet, which routes to an Internet Gateway and out to the internet. Row two: users connect through AWS Client VPN to a Client VPN ENI in a private subnet, which routes to a NAT Gateway in a public subnet, then to the Internet Gateway and out. In both cases the traffic exits through the VPC's own gateway rather than the laptop's local connection. ENI in a public subnet — straight out an Internet Gateway users AWS Client VPN ENI · public subnet IGW internet ENI in a private subnet — via a NAT Gateway, then the Internet Gateway users AWS Client VPN ENI · private subnet NAT GW IGW internet the client's internet traffic leaves through the VPC's gateway — not the laptop's for redundancy, associate the endpoint with a subnet in each of two AZs unlike a NAT Gateway, this is fine — the traffic originates inside the VPC (on the ENI)

Note the contrast with Site-to-Site VPN: there, a NAT Gateway refused the traffic because it arrived from on-prem via the VGW. Here it is fine, because the client's traffic originates inside the VPC at the Client VPN ENI — which is exactly what a NAT Gateway serves.

Để ý điểm khác với Site-to-Site VPN: ở đó NAT Gateway từ chối traffic vì nó đến từ on-prem qua VGW. Ở đây thì ổn, vì traffic của client khởi phát bên trong VPC tại Client VPN ENI — đúng loại traffic mà NAT Gateway phục vụ.

Client VPN + Transit Gateway — one endpoint, many VPCsClient VPN + Transit Gateway — một endpoint, nhiều VPC

Attach VPC-A to a Transit Gateway and the single Client VPN Endpoint suddenly reaches every VPC on the TGW, and on-premises through the TGW's Direct Connect or VPN attachment. A VPC that is only peered to VPC-A is still reachable directly — you do not have to route everything through the hub. Gắn VPC-A vào một Transit Gateway là endpoint Client VPN duy nhất bỗng với tới mọi VPC trên TGW, và tới on-premises qua attachment Direct Connect hoặc VPN của TGW. Một VPC chỉ peer với VPC-A thì vẫn tới thẳng được — không bắt buộc phải đi vòng qua hub.

Client VPN combined with Transit Gateway. Users connect through AWS Client VPN into VPC-A on 10.1.0.0/16, which has Client VPN ENIs in two Availability Zone private subnets. VPC-A attaches to a Transit Gateway in the centre, which fans out to VPC-B on 10.2.0.0/16, VPC-C on 10.3.0.0/16, and a corporate data centre over Direct Connect or a VPN connection. Separately, VPC-D on 10.4.0.0/16 is reached directly from VPC-A by VPC peering rather than through the Transit Gateway. one endpoint → TGW fans out to many VPCs and on-prem users AWS Client VPN VPC-A · 10.1.0.0/16 ENI · AZ-A ENI · AZ-B Transit Gateway VPC-B · 10.2.0.0/16 VPC-C · 10.3.0.0/16 Corporate DC Direct Connect / VPN VPC peering VPC-D · 10.4.0.0/16 TGW = the scalable hub peering = a direct side road

This is the pattern to remember for "remote users must reach a fleet of VPCs and the data centre": Client VPN for the people, Transit Gateway for the fan-out. Peering to VPC-D is drawn to make the point that the two can coexist — not everything has to route through the TGW.

Đây là mô hình cần nhớ cho đề "người dùng từ xa phải với tới cả loạt VPC và data center": Client VPN cho con người, Transit Gateway để toả ra. Peering tới VPC-D vẽ vào để nói rõ hai thứ sống chung được — không phải cái gì cũng bắt buộc đi qua TGW.

Things that catch you outNhững chỗ dễ sập bẫy

  • Connected, but a subnet is unreachable. The authorization rule is missing, or there is no route on the endpoint for that network. Both are required, per destination network. Kết nối được mà không tới được một subnet. Thiếu authorization rule, hoặc endpoint chưa có route tới mạng đó. Cả hai đều bắt buộc, cho từng mạng đích.
  • Reaching a peered VPC still needs a route. "Compatible with peering" does not mean automatic — you add a route on the Client VPN Endpoint and the VPC route tables must carry the peer, as always. Tới VPC đã peer vẫn cần route. "Tương thích peering" không có nghĩa là tự động — bạn phải thêm route trên Client VPN Endpoint và route table của VPC vẫn phải có peer như thường lệ.
  • No internet just because you're connected. Full-tunnel internet needs the ENI's subnet to route to an IGW or NAT Gateway, plus a 0.0.0.0/0 route and authorization rule on the endpoint. Kết nối rồi không tự có internet. Internet kiểu full-tunnel cần subnet của ENI có route tới IGW hoặc NAT Gateway, kèm route 0.0.0.0/0 và authorization rule trên endpoint.
  • Single-AZ association = single point of failure. Associate the endpoint with a subnet in two AZs so an AZ outage doesn't drop everyone. Chỉ gắn một AZ = một điểm chết. Gắn endpoint với subnet ở hai AZ để một AZ hỏng không làm rớt tất cả.
  • It is Client VPN, not Site-to-Site. If the scenario connects a network/site, this is the wrong service; Client VPN is for individual clients. Đây là Client VPN, không phải Site-to-Site. Nếu đề nối một mạng/site thì đây là sai service; Client VPN dành cho từng client lẻ.

Exam reflexesPhản xạ khi thi

The question says…Đề nói… AnswerĐáp án
"Remote employees on laptops need private access to a VPC""Nhân viên từ xa dùng laptop cần truy cập private vào VPC" AWS Client VPN (managed OpenVPN endpoint)AWS Client VPN (endpoint OpenVPN được quản lý)
"Connected users must also reach on-premises / a peered VPC""Người dùng đã kết nối còn phải với tới on-premises / VPC đã peer" Client VPN rides the Site-to-Site VPN / peering — add route + authorization ruleClient VPN đi ké Site-to-Site VPN / peering — thêm route + authorization rule
"Remote users must reach many VPCs and the data centre""Người dùng từ xa phải với tới nhiều VPC và data center" Client VPN + Transit GatewayClient VPN + Transit Gateway
"Give a contractor group access to one subnet only""Cho nhóm contractor truy cập đúng một subnet" Authorization rules scoped to that group / networkAuthorization rule giới hạn theo nhóm / mạng đó
"Connect a whole branch office network to AWS""Nối cả một mạng chi nhánh vào AWS" Site-to-Site VPN — not Client VPNSite-to-Site VPN — không phải Client VPN
"Highly available client access, no single AZ risk""Truy cập client sẵn sàng cao, không rủi ro một AZ" Associate the endpoint with a subnet in two or more AZsGắn endpoint với subnet ở hai AZ trở lên