A Smaller Bedrock Gateway, Part 8: Deploy, Validate, and Operate the Gateway
Deploy the gateway with a migration gate, send the first request, confirm it stayed private, and operate it day to day.
Series: A Smaller Bedrock Gateway (8 articles)
- …
- 8A Smaller Bedrock Gateway, Part 8: Deploy, Validate, and Operate the Gateway This article
Last updated: 2026-11-13 (Fri) 18:22 GST
Over the last six parts, we built the network, the image, and the gateway template one layer at a time. In this final part, I will deploy the gateway with a migration gate, send the first request, and confirm in CloudTrail that it stayed private. Then I will explain how this deployment was validated end to end, and how to rotate credentials, upgrade safely, and clean up. Use the same shell as Parts 3 and 4, so the variables are still set.
Deployment validation status for the version in this series:
PASS (2026-11-13, eu-central-1 ). 63 automated checks passed and 0 failed. 2 non-required checks were recorded as manual: corporate routing and hybrid DNS, which these stacks do not create, and VPC Flow Log correlation, which is supplemental. The probe passed in both private subnets, and CloudTrail showed exactly one Bedrock event per admitted probe call, matched by request ID, and none for the budget-denied call.Step 1: Deploy the gateway stack with no tasks
Deploy the gateway stack with
ServiceDesiredCount=0 . CloudFormation creates the database, Valkey, the load balancer, and the task definitions, but it does not start the gateway yet, because the database schema does not exist. This step takes about 20 minutes, mostly for the Multi-AZ database.aws cloudformation deploy \ --stack-name "$GATEWAY_STACK" \ --template-file 07-02-litellm-gateway.yaml \ --s3-bucket "$TEMPLATE_BUCKET" \ --capabilities CAPABILITY_IAM \ --parameter-overrides \ NetworkStackName="$NETWORK_STACK" \ CertificateArn="$CERTIFICATE_ARN" \ ClientIngressCidr="$CLIENT_CIDR" \ AdminIngressCidr="$ADMIN_CIDR" \ GatewayDomainName=litellm.internal.example \ ModelId=eu.anthropic.claude-sonnet-4-6 \ FoundationModelId=anthropic.claude-sonnet-4-6 \ ContainerImage="$CONTAINER_IMAGE" \ ValkeyResourceId=gw01 \ ServiceDesiredCount=0ValkeyResourceId names the Valkey user and replication group, so give each deployment its own value. When the stack finishes, both stacks show CREATE_COMPLETE in the CloudFormation console.
Figure 1. The network and gateway stacks in the CloudFormation console after deployment.
Step 2: Run the database migration
The migration must exit with code 0 before you start the gateway.
CLUSTER=$(out "$GATEWAY_STACK" ClusterName)TASK_ARN=$(aws ecs run-task \ --cluster "$CLUSTER" \ --task-definition "$(out "$GATEWAY_STACK" MigrationTaskDefinitionArn)" \ --launch-type FARGATE --platform-version 1.4.0 \ --network-configuration "awsvpcConfiguration={subnets=[$(out "$GATEWAY_STACK" PrivateSubnet1Id)],securityGroups=[$(out "$GATEWAY_STACK" TaskSecurityGroupId)],assignPublicIp=DISABLED}" \ --query 'tasks[0].taskArn' --output text)
aws ecs wait tasks-stopped --cluster "$CLUSTER" --tasks "$TASK_ARN"aws ecs describe-tasks --cluster "$CLUSTER" --tasks "$TASK_ARN" \ --query "tasks[0].containers[?name=='migration'].exitCode" --output textThe last command must print
0 . In the ECS console, the stopped task shows the same result. The task log group also contains two lines, LiteLLM database migrations completed. and LiteLLM runtime database roles are ready. 
Figure 2. The one-shot migration task stopped with exit code 0.
Step 3: Start the gateway
Now raise the service to two tasks. Parameters you leave out keep their current values.
aws cloudformation deploy \ --stack-name "$GATEWAY_STACK" \ --template-file 07-02-litellm-gateway.yaml \ --s3-bucket "$TEMPLATE_BUCKET" \ --capabilities CAPABILITY_IAM \ --parameter-overrides ServiceDesiredCount=2When the update finishes, the ECS console shows two running tasks.

Figure 3. The gateway service with two of two tasks running on Fargate.
In the EC2 console, under Target groups, both task IP addresses should be registered and healthy.

Figure 4. Both gateway tasks registered and healthy behind the internal Application Load Balancer.
Step 4: Send your first request
Run these commands from a host that sits in your administrator range and trusts your certificate. First, mint a virtual key with a small budget.
ADMIN_KEY="sk-$(aws secretsmanager get-secret-value \ --secret-id "$(out "$GATEWAY_STACK" AdministratorKeySecretArn)" \ --query SecretString --output text | python3 -c 'import json,sys; print(json.load(sys.stdin)["administrator_key"])')"
curl -s https://litellm.internal.example/key/generate \ -H "Authorization: Bearer $ADMIN_KEY" -H 'Content-Type: application/json' \ -d '{"models": ["claude-sonnet-eu"], "max_budget": 5, "budget_duration": "30d"}'The response contains a
key that starts with sk- . Give it to an application in your client range, which calls the gateway like any OpenAI-compatible endpoint.curl -s https://litellm.internal.example/v1/chat/completions \ -H "Authorization: Bearer $VIRTUAL_KEY" -H 'Content-Type: application/json' \ -d '{"model": "claude-sonnet-eu", "messages": [{"role": "user", "content": "Say hello in one word."}]}'To confirm the call stayed private, open CloudTrail Event history and filter on the event name
Converse . The event details show a private source address from the VPC, and the event record carries a vpcEndpointId , which is the Bedrock runtime interface endpoint that carried the request. Because the model alias uses an EU cross-Region inference profile, the inferenceRegion field shows which EU Region served the call.
Figure 5. The CloudTrail record for a Converse call, with the VPC endpoint ID and the inference Region.
How this deployment was validated
The validation went beyond "the stack deployed." A harness deployed both stacks with the same steps as this series, ran the migration, started two replicas, and then ran a probe task in each private subnet. The probe has no Bedrock permissions of its own. It checks:
- TLS and the exact host name on the internal load balancer, and that the wrong host name is rejected.
- Readiness and liveness, and that every path outside the allowed list returns a fixed 403.
- That a virtual key works, a bogus key is rejected, and a key limited to another model is denied.
- Normal and streaming chat completions.
- That spend is recorded, and that a key whose budget is below the cost of one request is denied before any call reaches Bedrock.
- That a direct connection to the internet fails.
Outside the tasks, the harness also checked routes, security groups, endpoint policies, DNS Firewall, the database and Valkey settings, encryption, and log hygiene. It then waited for CloudTrail to settle and matched each admitted call to exactly one Bedrock event through the VPC endpoint by request ID, with no event for the denied call. The checks that stayed manual were corporate routing and hybrid DNS, which the stacks do not create, and VPC Flow Log correlation, which is supplemental because delivery can lag.
Rotate credentials without downtime
The application database credentials use two slots, A and B. To rotate, update only the inactive secret, run the migration task again so the new login exists, switch
ActiveAppCredentialSlot , wait for the ECS deployment to finish and old tasks to drain, and then update the former active secret. Valkey credentials work the same way with ActiveValkeyCredentialSlot ; also increase ValkeyCredentialRevision so ECS starts tasks with the new value.Updating the administrator key secret does not refresh running tasks. Pause key management, update the secret, force a new ECS deployment, test the new key, and resume. Never rotate the LiteLLM salt once encrypted values are stored. RDS manages its own administrator password, and the runtime tasks never receive it.
Upgrade safely
For an image or schema upgrade, take and test a database backup first. Use the same image digest for the migration and the new runtime, and remember that rolling back the ECS service does not roll back a database migration. For a blue/green replacement, deploy a new pair of stacks with new names, run the full validation, then move private DNS. A new gateway stack starts with a new database and a new salt, so either migrate the keys and spend data deliberately or reissue keys.
Know the limits
- The model set is fixed to Claude Sonnet 4.6 from Frankfurt through the six AWS Europe geography destinations. Recheck model lifecycle and destinations before each deployment.
- The stacks do not deploy PII redaction, Bedrock Guardrails, a CloudTrail trail, model invocation logging, or a structured per-request audit record.
- Corporate routing, return routes, hybrid DNS, and client certificate trust are yours to provide.
- TLS ends at the load balancer; the hop to the task is HTTP inside the security-group boundary.
- Budget denial uses an estimated request cost, so a budget is a strong control, not a guarantee to the cent.
- Valkey is required for correct coordination between replicas; while it is unavailable, requests are denied.
Clean up
The database and load balancer have deletion protection turned on, so turn it off first, then delete the gateway stack before the network stack.
aws cloudformation deploy --stack-name "$GATEWAY_STACK" \ --template-file 07-02-litellm-gateway.yaml --s3-bucket "$TEMPLATE_BUCKET" \ --capabilities CAPABILITY_IAM --parameter-overrides \ ServiceDesiredCount=0 EnableDatabaseDeletionProtection=false EnableAlbDeletionProtection=falseaws cloudformation delete-stack --stack-name "$GATEWAY_STACK"aws cloudformation wait stack-delete-complete --stack-name "$GATEWAY_STACK"aws cloudformation delete-stack --stack-name "$NETWORK_STACK"aws cloudformation wait stack-delete-complete --stack-name "$NETWORK_STACK"Some resources are kept on purpose so that you cannot lose data by deleting a stack: the KMS keys, the secrets, the log groups, the private hosted zone, the load balancer log bucket and its policy, and final database and Valkey snapshots. Delete them when you no longer need them.
A quick recap of activities
In this part, we:
- Deployed the gateway with no tasks, ran the migration to exit code 0, and only then started two replicas.
- Minted a budgeted virtual key, sent a request, and confirmed in CloudTrail that it used the Bedrock VPC endpoint.
- Reviewed how the deployment was validated, including that budget-denied calls never reach Bedrock.
- Covered credential rotation, safe upgrades, the limits of the design, and cleanup.
Conclusion
A small, private gateway gives you non-AWS virtual keys, spend limits enforced before the model call, and one boundary to audit, without opening a path to the internet. Start with direct Bedrock access, and reach for this design when those needs are real. When you do, build on the latest stable LiteLLM release, keep the migration gate, and rerun the validation every time something changes.
This is Part 8 of the eight-part A Smaller Bedrock Gateway series. Part 1 covers the design, Parts 2 and 3 the network stack, Part 4 the hardened image, Parts 5 to 7 the gateway stack, and Part 8 the deployment, validation, and day-two operations.
Series: A Smaller Bedrock Gateway (8 articles)
- …
- 8A Smaller Bedrock Gateway, Part 8: Deploy, Validate, and Operate the Gateway This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article