Skip to main content
Terraform module v7 makes ECS and the private Braintrust Gateway the defaults for AWS deployments, and removes the API Lambda functions that v6 kept warm when API traffic runs on ECS. Module v7.0.0 ships data plane v2.20.0 image tags.
Breaking change: These variables default to true on v7 instead of false:
  • enable_ecs_api
  • create_ai_gateway
  • enable_ai_gateway
  • use_private_ai_gateway_origin
If your configuration relies on the v6 defaults, the v7 apply moves API traffic from Lambda to ECS, deletes the APIHandler and AI Proxy Lambda functions, their public function URL, and API Gateway, and builds and enables the Gateway. Before you apply, set the variables for your configuration.
Always upgrade one major version at a time. If you are on v5.x, upgrade to v6 first. See the routine upgrade guide for the standard process.

What changed

  • Omitted variables mean ECS and the Gateway. On v6, omitted variables mean Lambda and no Gateway. On v7, the module routes API traffic to ECS, builds the Gateway, routes the API and Loop runtime through it, and points CloudFront /v1/proxy at it. The Gateway adds AWS charges.
  • The API Lambda functions are removed in ECS mode. When enable_ecs_api is true, the module deletes the APIHandler and AI Proxy Lambda functions, the AI Proxy function URL, and API Gateway. The quarantine, database migration, catchup ETL, and cron Lambda functions stay. Setting enable_ecs_api back to false creates a new Lambda path with a new function URL hostname. It doesn’t restore the previous functions.
  • Quarantine LLM calls use CloudFront when the AI Proxy function is gone. Without quarantine_proxy_url or use_private_gateway_quarantine_proxy, LLM calls from custom scorers and tools go to the deployment’s CloudFront /v1/proxy URL through the quarantine VPC’s NAT gateway. If you restrict CloudFront with a WAF or a source IP allowlist, allow that NAT gateway address. To keep these calls inside your VPCs instead, see Braintrust Gateway.

Before you upgrade

If you’re moving to the private Gateway, the v7 default, finish these applies on the latest v6 release before you bump the module. For any other configuration, skip to Choose your configuration.
  1. Build the API ECS services. This is the first apply of the v6 upgrade, with enable_ecs_api left at its v6 default of false, so customer traffic stays on Lambda.
  2. Build the Gateway without moving traffic and apply:
  3. Cut over API traffic and the Gateway together and apply:
  4. Run API requests, ingest traces, and run an eval to confirm traffic flows through ECS and the Gateway.

Choose your configuration

Set the routing variables in your module block to match the configuration you want on v7.

Private Gateway (default)

After the v6 applies, your configuration matches the v7 defaults. You can keep these lines or remove them:

Stay on Lambda

To keep customer traffic on Lambda, set enable_ecs_api = false, then pick the Gateway settings that match your deployment.
If you built the Gateway on v6 but haven’t enabled it, keep create_ai_gateway = true so the apply doesn’t destroy the Gateway load balancer and ECS service. Enable the other two variables in a later apply.
To keep the Gateway absent, set all four variables to false:
The three Gateway variables default to true, so this apply builds the Gateway if it doesn’t exist, enables it, and points CloudFront /v1/proxy at it.

Run without the Gateway

To run on ECS without the Gateway, set all three Gateway variables to false:
Setting only create_ai_gateway = false fails the plan, because the other two variables default to true. A deployment still on Lambda moves to ECS on this apply, which deletes the API Lambda functions, their function URL, and API Gateway. To stay on Lambda, also set enable_ecs_api = false.

Use the Braintrust-hosted Gateway

To route CloudFront /v1/proxy to the Braintrust-hosted Gateway instead of a private one:
Set all five variables:
  • create_ai_gateway and enable_ai_gateway: If you omit them, the apply still builds the private Gateway and points the API and Loop runtime at it, because both default to true.
  • use_private_gateway_quarantine_proxy: Must be false, because it requires create_ai_gateway.
Quarantine LLM calls that use the CloudFront /v1/proxy URL leave your data plane for the hosted Gateway. As with Run without the Gateway, a deployment still on Lambda moves to ECS on this apply unless you also set enable_ecs_api = false.

Upgrade steps

1

Bump the module to v7

Update your module source and add the variables for the configuration you chose:
2

Review and apply

Review the terraform plan output before you apply. If the plan deletes the APIHandler or AI Proxy Lambda functions, API Gateway, or the Gateway load balancer and you didn’t intend it, set the routing variables explicitly before you apply. If you see something else unexpected, like deletion of a database or S3 bucket, contact Braintrust for help.
3

Verify the data plane

Exercise the data plane. Run API requests, ingest traces, and run an eval. Go to Settings > Brainstore and confirm all settings under Brainstore configuration show green status.

Roll back to v6

Before you roll back to a v6 release, set enable_ecs_api = true in your configuration. On v6 the default is false, so an omitted variable creates the Lambda path again, including the APIHandler and AI Proxy Lambda functions, a new function URL, and API Gateway. Set the Gateway variables explicitly too, because they default to false on v6.

Next steps