Terraform for standing up an Amazon Bedrock AgentCore Gateway with:
- Private VPC access — an AWS PrivateLink interface endpoint (
com.amazonaws.<region>.bedrock-agentcore.gateway) with private DNS, so the gateway data plane is reachable from inside a VPC without traversing the internet. - Model inference —
bedrock-mantle(OpenAI Responses/Chat Completions and Anthropic Messages APIs) andbedrock-runtime(OpenAI-compatible chat completions) targets served at the gateway's/inferencepath. - Traffic inspection — a Python echo interceptor Lambda invoked at REQUEST and RESPONSE that logs every payload flowing through the gateway and returns it unchanged.
| Path | Purpose |
|---|---|
modules/agentcore-gateway |
Reusable module: gateway, VPC endpoint, inference targets, interceptor Lambda, IAM. |
environments/dev |
Deployable dev configuration: minimal VPC (private subnets only) plus the module. |
cd environments/dev
terraform init
terraform plan
terraform applySee the dev environment README for testing the gateway after apply (tailing interceptor logs, invoking /inference from inside the VPC).
- Terraform >= 1.5.0
- AWS provider >= 6.55.0
- A recent AWS CLI v2 on the machine running Terraform — the inference targets are created through
aws bedrock-agentcore-controlbecause the provider cannot manage them yet (hashicorp/terraform-provider-aws#48705)
- The gateway's public endpoint cannot be disabled; the VPC endpoint adds private access, and IAM conditions (e.g.
aws:SourceVpce) are needed to enforce VPC-only access. - Dev state lives in the S3 backend configured in
environments/dev/backend.tf— point it at your own bucket beforeterraform init.