I built a three-VPC AWS environment (Payments, Analytics, Shared Services) where an internal API is consumed by the other two VPCs exclusively over AWS PrivateLink. There is no VPC peering, no NAT for the service path, no public IP on the backend, and no inbound internet route to the application.
This post covers the design decisions, the build, how to verify it, and the hardening steps I would apply before calling it production-ready.
The Problem
Imagine a growing fintech with three internal systems:
| System | Responsibility |
|---|---|
| Payments | Handles customer transactions |
| Analytics | Runs reports and insights |
| Shared Services | Hosts internal APIs used by other teams |
For security and compliance, each system lives in its own VPC. But Payments and Analytics still need to call the shared APIs, and the constraints are strict:
- Nothing is exposed to the public internet
- No sprawling VPC peering mesh to maintain
- No SSH or public endpoints on backend services
Why PrivateLink (and Not Peering)?
VPC peering works, but it connects networks. Once two VPCs are peered, you are managing route tables on both sides, and you must guarantee that CIDR ranges never overlap. With three or more VPCs the number of connections grows quickly, and every connection widens the blast radius.
AWS PrivateLink connects a service, not a network. The consumer gets a private endpoint (an ENI in its own subnet) that reaches exactly one published service, and nothing else in the provider VPC.
| VPC Peering | PrivateLink | |
|---|---|---|
| Exposes | Entire network | A single service |
| Overlapping CIDRs | Not allowed | Allowed |
| Route table changes | Both sides | None |
| Connection direction | Bidirectional | Consumer → Provider only |
| Provider control | Limited | Explicit approval per consumer |
For "many consumers, one shared service", PrivateLink is the cleaner model.
Architecture
The request path is:
Payments / Analytics VPC → Interface Endpoint (ENI) → PrivateLink → Endpoint Service (Shared Services VPC) → Internal Network Load Balancer → Target Group → EC2 (Apache, private subnet, no public IP) The response returns along the same path. At no point does traffic touch the public internet.
Network plan
| VPC | CIDR | Subnets |
|---|---|---|
payments-vpc | 10.10.0.0/16 | public 10.10.1.0/24, private 10.10.2.0/24, 10.10.3.0/24 |
analytics-vpc | 10.20.0.0/16 | public 10.20.1.0/24, private 10.20.2.0/24, 10.20.3.0/24 |
shared-services-vpc | 10.30.0.0/16 | public 10.30.1.0/24, private 10.30.2.0/24, 10.30.3.0/24 |
Non-overlapping /16 ranges are a good habit even though PrivateLink does not require them. They keep the door open for peering, Transit Gateway, or VPN later without a painful re-IP.
AWS services used
Amazon VPC, subnets and route tables, EC2, Security Groups, Network Load Balancer, and AWS PrivateLink (endpoint service on the provider side, interface endpoints on the consumer side).
Step 1: Build the Three VPCs
Each VPC is created with VPC only in the console so every component is explicit. The pattern is identical for all three:
- Create the VPC with the CIDR above.
- Create one public subnet and two private subnets (in different AZs in Shared Services, which the NLB needs for high availability).
- Use the main route table as the private route table (local routes only).
- Create a
*-public-rt, associate the public subnet, and attach an Internet Gateway with a0.0.0.0/0route.
The private subnets deliberately have no route to an Internet Gateway. That is what makes "private" mean private.
Convention tip: name everything with a
<system>-<resource>prefix (payments-public-rt,shared-igw). Once you have three VPCs, console lists get confusing fast.
Step 2: Security Groups (Least Privilege)
I avoided the default security groups. They are permissive and easy to confuse across VPCs. Instead I created one dedicated group per VPC:
| Security Group | VPC | Inbound |
|---|---|---|
shared-app-sg | shared-services-vpc | HTTP 80 from 10.0.0.0/8 |
payments-client-sg | payments-vpc | Defined per client/endpoint needs |
analytics-client-sg | analytics-vpc | Defined per client/endpoint needs |
Hardening note:
10.0.0.0/8is convenient for a lab but broader than necessary. In production I would scope it to the two consumer ranges only (10.10.0.0/16and10.20.0.0/16), or reference the NLB/endpoint security groups directly.
Remember that the interface endpoint's security group must allow inbound traffic on the service port (TCP 80 here) from the consumer's clients. This is a common cause of "endpoint is Available but requests hang".
Step 3: Deploy the Internal Service
The backend is a single EC2 instance (Amazon Linux 2023, t3.micro) in shared-private-subnet-1:
- Auto-assign public IP: Disabled
- Security group:
shared-app-sg - Bootstrapping: EC2 User Data, with no SSH session needed
#!/bin/bash dnf update -y dnf install -y httpd systemctl enable --now httpd cat > /var/www/html/index.html << 'EOF' <!DOCTYPE html> <html> <head><meta charset="UTF-8"><title>Shared Services - Internal API</title></head> <body> <h1>PrivateLink Internal Service</h1> <p>Reachable only from approved VPCs via AWS PrivateLink.</p> <pre>{ "service": "shared-services-app", "vpc": "shared-services-vpc", "status": "healthy", "access": "private-only" }</pre> </body> </html> EOF The page stands in for any real internal service: billing, identity, metrics ingestion, central configuration.
Production note on bootstrapping: an instance in a private subnet with no NAT cannot reach public package repositories. For real workloads, either bake an AMI with the app preinstalled, or provide controlled egress (a NAT Gateway, or an S3 gateway endpoint, which serves Amazon Linux 2023 repositories without internet access).
I intentionally did not SSH into the instance. It has no public IP and no internet route, so verification happens through the load balancer and PrivateLink instead.
Step 4: Publish the Service (the Provider Side)
PrivateLink integrates with Network Load Balancers, which operate at Layer 4. That means three components.
4.1 Target Group
- Target type: Instances
- Protocol/Port: TCP / 80
- VPC:
shared-services-vpc - Register
shared-services-app
4.2 Internal NLB
- Scheme: Internal (the critical setting; it cannot be changed later)
- Subnets:
shared-private-subnet-1andshared-private-subnet-2 - Listener: TCP 80 →
shared-services-tg
4.3 Endpoint Service
In VPC → Endpoint Services, create shared-internal-service backed by shared-services-nlb.
I kept Require acceptance for endpoint connections enabled. The provider decides which consumers get in, which is exactly the control a platform team wants.
Once created, copy the Service Name (com.amazonaws.vpce.<region>.vpce-svc-xxxxxxxx). Consumers need it.
Step 5: Consume the Service (the Consumer Side)
In each of payments-vpc and analytics-vpc:
- VPC → Endpoints → Create endpoint
- Type: Endpoint services that use NLBs and GWLBs
- Paste the service name and click Verify service
- Select the consumer VPC, subnets, and security group
- Create the endpoint
The new endpoint lands in Pending acceptance, which is expected:
Step 6: Approve the Connections
Back on the provider side, open Endpoint services → shared-internal-service → Endpoint connections, select both requests, and choose Actions → Accept endpoint connection.
Both consumers now show Available.
Verification
Verification has two sides: proving the service is not exposed, and proving it is reachable through PrivateLink.
Negative test: the internet cannot reach it
From a laptop outside AWS:
curl --max-time 10 http://<nlb-dns-name> # curl: (28) Failed to connect ... Connection timed out A timeout here is the success condition. It confirms the NLB is internal-only and the backend has no public path.
Design Takeaways
1. The provider controls access. Acceptance is explicit per consumer, and revoking a connection is a single action.
2. No network-level coupling. There are no peering routes, no CIDR coordination, and no transitive-routing surprises. A consumer can only reach the one published port.
3. Failure modes are predictable. In practice, "endpoint Available but request hangs" almost always traces back to one of three things: the endpoint security group not allowing the service port, the NLB or target security group not allowing the source range, or a failing target health check.
4. Pay attention to cost. Interface endpoints and NLBs are billed hourly (plus data processing). This lab costs very little over a few hours, but forgotten endpoints add up, so clean up promptly.
What I'd Add for Production
- Multi-AZ consumers and targets (an Auto Scaling group behind the NLB instead of a single instance)
- Private DNS names for the endpoint service so clients use a friendly hostname
- Tighter security groups referencing consumer ranges or groups instead of
10.0.0.0/8 - Allowed principals on the endpoint service to pre-authorize specific AWS accounts
- TLS on the listener, with certificate management
- VPC Flow Logs and CloudWatch alarms on target health and endpoint metrics
- Infrastructure as Code (Terraform or CloudFormation) so the whole topology is reproducible
Cleanup
Delete in dependency order to avoid errors:
- Interface endpoints (Payments and Analytics)
- Endpoint service (after connections are removed)
- Network Load Balancer, then target group
- EC2 instances (app and any test clients)
- Custom security groups, then the three VPCs
Conclusion
PrivateLink turns "share an internal service" from a networking project into a publishing decision. The provider exposes one service, consumers opt in, the provider approves, and the traffic never leaves the AWS network. For fintech and other regulated environments, that combination of isolation and controlled access is exactly the point.
If you are building a platform-service model across multiple VPCs or accounts, this pattern is a strong default.
Questions or improvements? Drop them in the comments. I'd love to hear how you handle cross-VPC service sharing.
Connect with me: www.linkedin.com/in/shehzad-ahmad153













