Maintain network isolation with VPC peering
Compliance, security, and data residency rules often require traffic to internal systems to stay on private networks. Your MCP servers, agents, and internal APIs run in an AWS virtual private cloud (VPC), and giving each one a public endpoint so the gateway can reach it widens the attack surface and adds another endpoint to secure for every new service.
What you can do
- Peer your Agent Gateway appliance with a VPC in your AWS account, so that traffic between the gateway and your services stays on a private network path.
- Point a surface at a service by its private IP address or its internal load balancer’s DNS name, so that the service keeps no public endpoint.
- Peer with a VPC in another AWS region, so that the appliance and your services can each run where they need to.
- Keep callers on the gateway’s public entry point while the services behind it stay private, so that only the gateway faces the internet.
How it works
VPC peering is an AWS network connection between two VPCs. Once the appliance’s network and your VPC are peered, the gateway reaches a service in your VPC by its private IP address, as it would a service in its own network.
You set up peering in Affinidi Portal when you create the appliance configuration, on any size except Basic. You give the details of your VPC and of an AWS Identity and Access Management (IAM) role in your account that lets Affinidi set up the peering connection. Affinidi then creates the peering connection and routes your VPC’s address range from the appliance’s side. On your side, you route the appliance’s address range through the peering connection and allow the gateway in your services’ security groups. AWS peers only VPCs whose address ranges don’t overlap, so your VPC needs a range distinct from the appliance’s.
In a surface, the managed agent’s Direct URL target or a Transit Point’s destination can then be a private address in your VPC, such as http://10.0.1.12:8080. Callers keep reaching the surface at its Entry point URL, so peering changes only how the gateway reaches your services. Cloud metadata endpoints stay blocked as targets, so a misconfigured target can’t read the cloud instance’s credentials.
The peering details are fixed once the configuration is created. To peer with a different VPC, create a new configuration with the new details. Each configuration peers with one VPC, and because every peered appliance uses the same address range, each VPC peers with one appliance.
Setting up VPC peering
Setting up peering takes these steps, covered in full in Reach services in your AWS VPC over VPC peering:
- Get Affinidi’s AWS account ID and the appliance’s address range from Affinidi support.
- In your AWS account, create an IAM role that Affinidi’s account can assume to accept a peering connection into your VPC.
- In Affinidi Portal, create an Agent Gateway configuration on a size other than Basic, and enter your VPC’s details and the role’s ARN in VPC Peering Details (optional).
- Once the deployment shows Complete, route the appliance’s address range through the peering connection in your VPC’s route tables.
- Allow the appliance’s address range in the security groups of the services the gateway calls.
- Point a surface’s Direct URL target at a service’s private IP address or an internal load balancer’s DNS name.
Related
- Reach services in your AWS VPC over VPC peering: Create the peering role, enter the peering details in Affinidi Portal, and route traffic to your services.
- Deploy Agent Gateway appliance: Provision an Affinidi-hosted instance through Affinidi Portal.
- Managed Agent: Every field of the target a surface forwards requests to.
- Let agents work across companies: Connect to a gateway in another company or cloud over an encrypted tunnel, where peering doesn’t fit.
Glad to hear it. Thanks for letting us know.
Sorry to hear that. Thanks for letting us know.
Still stuck? Ask the community on Discord or contact us.