{"slug": "connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with", "title": "Connect Amazon Bedrock AgentCore Gateway to private APIs in a hub-and-spoke network with centralized inspection", "summary": "AWS published a tested reference pattern for connecting Amazon Bedrock AgentCore Gateway to private APIs and Model Context Protocol (MCP) servers in a hub-and-spoke network where all traffic crosses a central firewall in both directions. The pattern, built and validated in the US East (N. Virginia) region (us-east-1) with three member accounts and a management account in AWS Organizations, places the Amazon VPC Lattice resource gateway so a central network team keeps ownership of every subnet while application teams manage only their own resources and security groups. AWS published the CloudFormation templates, test scripts, test evidence and reference material in a companion GitHub repository and advises teams to adjust the pattern to their own account architecture.", "body_md": "## [Artificial Intelligence](https://aws.amazon.com/blogs/machine-learning/)\n\n# Connect Amazon Bedrock AgentCore Gateway to private APIs in a hub-and-spoke network with centralized inspection\n\nIn many enterprises, a central network team owns every virtual private cloud (VPC) and subnet, and every flow between VPCs must pass a central firewall in both directions. Agents that call internal REST APIs and Model Context Protocol (MCP) servers through [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html), a capability of Amazon Bedrock AgentCore, must meet the same two requirements. Amazon Bedrock AgentCore is a platform to build, connect, and optimize agents at scale, with any framework or model.\n\nThis post shows a pattern that meets both requirements. The network team keeps ownership of every subnet, and traffic between the Gateway and your private APIs and MCP servers crosses the central firewall in both directions. It covers where to place the Amazon VPC Lattice resource gateway that the Gateway uses to reach private targets. It also covers who owns each piece, six configuration decisions, and the checks that confirm the pattern works.\n\nWe built and tested the pattern in the US East (N. Virginia) AWS Region (`us-east-1`), in a lab with three member accounts and a management account in AWS Organizations. The AWS CloudFormation templates, test scripts, test evidence, and reference material (address plan, full validation checks, troubleshooting, quotas) are in the [companion repository](https://github.com/aws-samples/sample-bedrock-agentcore-gateway-hub-spoke-inspection). Use the pattern as a guideline and adjust it to your own account architecture.\n\n### Terms used in this post\n\n- **Resource gateway:** The[Amazon VPC Lattice](https://docs.aws.amazon.com/vpc-lattice/latest/ug/what-is-vpc-lattice.html) entry point into a VPC: elastic network interfaces (ENIs) in subnets you choose. Backends see its addresses as the source of each connection.\n- **Resource configuration:** A VPC Lattice object that names one backend (here, an internal load balancer or VPC endpoint DNS name and port) behind a resource gateway. You can share it with other accounts through AWS Resource Access Manager (AWS RAM).\n- **Managed mode and self-managed mode:** The two[private endpoint](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/vpc-egress-private-endpoints.html) options for Gateway targets. In managed mode, AgentCore creates the resource gateway for you. In self-managed mode, you create it and give the target a resource configuration.\n\n## When to use this pattern\n\nUse this pattern when all of the following are true:\n\n- A network account owns every VPC, subnet, and AWS Transit Gateway attachment, and shares application subnets through AWS RAM.\n- A central firewall in an inspection VPC must inspect traffic entering and leaving every VPC.\n- Application teams manage only their own resources and security groups.\n\nOtherwise, one of the options in Table 1 fits better.\n\n*Table 1: When another option fits better.*\n\n| **Your environment** | **Use** | \n| The Gateway account can own subnets that reach your tools | [Managed mode](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/vpc-egress-private-endpoints.html#lattice-vpc-egress-managed-lattice) | \n| Traffic between the Gateway and the tools doesn’t need central inspection | [Self-managed mode](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/vpc-egress-private-endpoints.html#lattice-vpc-egress-self-managed-lattice) , as documented | \n| Tools are reachable on public endpoints | A standard [Gateway target](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) | \n\nWe also considered managed mode in subnets that AgentCore owns, a resource gateway in each tool VPC or in the central endpoints VPC, and internet-facing load balancers with AWS WAF per tool. The [alternatives write-up](https://github.com/aws-samples/sample-bedrock-agentcore-gateway-hub-spoke-inspection/blob/main/docs/considerations.md#alternatives-we-considered) explains why each falls short under these constraints.\n\n## Design requirements for centralized inspection\n\n- The network account owns every subnet. The Gateway and application accounts build only in subnets shared to them through AWS RAM.\n- Every flow between VPCs crosses the central firewall, in both directions. The central firewall in the inspection VPC inspects the traffic between the Gateway and your private APIs and MCP servers.\n\nAgentCore Gateway reaches private targets through a VPC Lattice resource gateway, and the two private endpoint modes place it differently. Managed mode creates it in the Gateway account, which fits environments where that account can own the subnets it runs in. Self-managed mode, as documented, places it in subnets with direct access to the backend, which fits environments that do not require inspection between the Gateway and the tool. This environment needs both conditions at once, so the pattern uses self-managed mode with one change. The network account owns the resource gateway and places it in subnets routed through AWS Transit Gateway, so every request and reply passes the inspection VPC.\n\n## Solution overview\n\nGive the resource gateway its own VPC and subnets in the network account. Don’t share them, and keep backends out of them. Route them through the transit gateway so every request and reply between VPCs crosses the firewall. Share one resource configuration per backend with the AgentCore account through AWS RAM. Figure 1 shows the accounts, VPCs, and traffic path.\n\n### Traffic path\n\n1. The agent, in a shared subnet with no internet route, calls the Gateway URL. Private DNS on the Gateway interface endpoint resolves it inside the agent’s VPC.\n2. AWS WAF, if attached, evaluates the request. The Gateway checks its resource policy and the inbound JSON Web Token (JWT), then picks the target and tool.\n3. The Gateway gets an outbound OAuth token for the tool account and sends the request through VPC Lattice to the resource gateway in the network account.\n4. The resource gateway subnets route to the transit gateway, which sends the traffic through the inspection VPC to the tool account’s internal Application Load Balancer (ALB) or `execute-api` endpoint. (Crosses the firewall.)\n5. The ALB or Amazon API Gateway validates the token and forwards the request to the backend.\n6. The response returns the same way. (Crosses the firewall.)\n\nHow does Gateway traffic enter the network account’s VPC without a transit gateway attachment in the AgentCore account? When you create a target, AgentCore associates the shared resource configuration with its own VPC Lattice service network. VPC Lattice then delivers connections from that service network to the resource gateway’s network interfaces in your VPC. AWS operates that hop, and from there your routes and firewall take over.\n\nWhat this pattern doesn’t do. Check these limits against your requirements before you adopt it:\n\n- **No payload inspection –** Traffic is TLS end to end from the Gateway to the ALB, with a certificate the Gateway validates. The firewall sees flow metadata and the TLS Server Name Indication (SNI), not payloads. Request content is in the Gateway, AWS WAF, and ALB logs.\n- **Some legs skip the firewall –** The agent-to-interface-endpoint leg and the Gateway-to-resource-gateway leg don’t cross it. Neither do the token requests that AgentCore makes to each identity provider.\n- **No end-user identity at the tool –** With the client credentials grant, every call that reaches the tool carries the Gateway’s client identity. To trace a call to a caller, use the inbound JWT claims in the Gateway application logs.\n\n## Who owns what\n\n*Table 2: Who creates what.*\n\n|  | **One time** | **New API on a connected ALB** | **New ALB or tool account** | \n| Network team | Resource gateway and its VPC, subnets, and routes. Firewall rules. A default route from the tool VPC to the transit gateway for the ALB’s signing-key fetch. Gateway interface endpoint and policy. AWS RAM share | Nothing | One resource configuration added to the share. A firewall rule if the range is new | \n| Tool team | An ALB certificate whose subject alternative name matches the target host name that the AgentCore team uses | A listener rule (with `jwt-validation` ) on their ALB | An internal ALB and security group, and an app client for the Gateway (client credentials grant, with a scope such as `tools/invoke` ) | \n| AgentCore team | Gateway, inbound authorizer, resource policy, optional AWS WAF | One Gateway target per API or MCP server | A target, plus an OAuth credential provider for a new identity provider | \n\nA new operation or tool on an existing target needs no new target: update the OpenAPI spec with `UpdateGatewayTarget`, or call `SynchronizeGatewayTargets` for an MCP server. The repository’s [build order](https://github.com/aws-samples/sample-bedrock-agentcore-gateway-hub-spoke-inspection/blob/main/docs/build-order.md) lists the steps in each account and the values the teams pass to each other.\n\n## Prerequisites\n\n- An organization in AWS Organizations with resource sharing in AWS RAM enabled.\n- AWS Command Line Interface (AWS CLI) 2.37.7 or later, or the AWS SDK for Python (Boto3) 1.43.106 or later, for the `certificateConfigurations` parameter.\n- For the role that creates Gateway targets: `vpc-lattice:GetResourceConfiguration` ,`vpc-lattice:CreateServiceNetworkResourceAssociation` ,`vpc-lattice:GetServiceNetworkResourceAssociation` ,`vpc-lattice:ListServiceNetworkResourceAssociations` , and`vpc-lattice:AssociateViaAWSService` , plus the bedrock-agentcore target actions. Check your service control policies (SCPs) if your organization doesn’t use VPC Lattice today.\n- A firewall in a central inspection VPC attached to the transit gateway with appliance mode enabled.\n\n## Key design decisions\n\nThe snippets are excerpts from the lab templates and use the lab’s [address plan](https://github.com/aws-samples/sample-bedrock-agentcore-gateway-hub-spoke-inspection/blob/main/docs/lab-layout.md). `RGW_NET` is the resource gateway subnets (10.0.1.0/24–10.0.3.0/24), `TOOL_NET` is the tool VPC (10.12.0.0/16), and `ALB_NET` is the ALB subnets in it.\n\n### Decision 1: Put the resource gateway in a dedicated VPC in the network account\n\nCreate a dedicated VPC in the network account for the resource gateway, with subnets you don’t share and no central endpoints or backends. Route those subnets to the transit gateway. Keep one resource gateway per trust zone.\n\nUsed only with AgentCore, the resource gateway [consumes one IP address per subnet](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/vpc-egress-private-endpoints.html#lattice-vpc-egress-compare-modes), so small subnets are enough. Two settings can’t be changed after creation, `Ipv4AddressesPerEni` and `ResourceConfigDnsResolution`, so choose them up front. Use Availability Zone IDs that VPC Lattice and your AgentCore features support. The [lab layout](https://github.com/aws-samples/sample-bedrock-agentcore-gateway-hub-spoke-inspection/blob/main/docs/lab-layout.md#availability-zones) lists them for `us-east-1`.\n\n### Decision 2: Create one resource configuration per load balancer, and share it through AWS RAM\n\nPoint the resource configuration at the internal ALB DNS name and share it with the AgentCore account. Don’t start the name with `rcfg-`, which VPC Lattice reserves.", "url": "https://wpnews.pro/news/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with", "canonical_source": "https://aws.amazon.com/blogs/machine-learning/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-network-with-centralized-inspection/", "published_at": "2026-11-18 19:05:45+00:00", "updated_at": "2026-11-18 19:11:37.773320+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-infrastructure", "artificial-intelligence"], "entities": ["Amazon Web Services", "Amazon Bedrock AgentCore Gateway", "Amazon Bedrock AgentCore", "Amazon VPC Lattice", "AWS Resource Access Manager", "AWS CloudFormation", "Model Context Protocol", "AWS Organizations"], "also_reported_by": [], "takeaway": "In a hub-and-spoke network where a central firewall must inspect traffic in both directions, place the VPC Lattice resource gateway in network-team-owned subnets and use self-managed mode with a shared resource configuration so AgentCore Gateway reaches private APIs and MCP servers through central i", "recommendation": {"advice": "Use self-managed mode with a VPC Lattice resource configuration shared via AWS RAM when a central network team owns all subnets and a firewall must inspect Gateway-to-tool traffic in both directions.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with", "markdown": "https://wpnews.pro/news/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with.md", "text": "https://wpnews.pro/news/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with.txt", "jsonld": "https://wpnews.pro/news/connect-amazon-bedrock-agentcore-gateway-to-private-apis-in-a-hub-and-spoke-with.jsonld"}}