When a team should deploy LiteLLM on AWS with the Terraform stack
A platform or security team should choose the official Terraform stack when it needs a self-hosted LiteLLM gateway inside its own AWS accounts and wants that infrastructure defined as code from the start. The stack provisions the gateway on ECS Fargate, with Aurora PostgreSQL, ElastiCache Redis, S3 and an Application Load Balancer, and it creates its own VPC. The gateway, backend and UI run as ECS services, so the team reviews one set of network, IAM and storage decisions rather than assembling each component by hand. The stack documentation in the BerriAI/litellm Terraform stacks README is the first read before any change to the defaults.
The database and cache choices explain why this stack is more than a container deployment. LiteLLM stores virtual keys, budgets and spend history in PostgreSQL, so losing or rebuilding that database means losing the records that govern who can call which model and how much they have spent. Redis holds shared state such as rate limits, router cooldowns and cache. Once more than one proxy task runs, LiteLLM expects Redis 7.0 or newer so every task sees the same limits and state. Because the ECS services scale horizontally, a team should confirm the Redis engine version the stack provisions in its own account and plan for it to be a dependency of every gateway task.
Before committing, the team should decide whether it owns the VPC design that the stack creates, how its Aurora and Redis endpoints will be reached from other workloads, and who approves changes to the image version pinned in the module. Confirm with your AWS landing zone owners whether a self-created VPC fits your network controls, and check the stack's current inputs against your own environment rather than assuming the defaults match your standards. If those answers point to a fixed network or a different orchestrator, a Kubernetes deployment may fit better.
How the AWS stack's parts connect
The request starts at a client and enters through the Application Load Balancer, which hands traffic to the gateway, backend and UI services running on ECS Fargate. The gateway reads and writes Aurora PostgreSQL through the writer endpoint, while the reader serves read traffic, and both connections use IAM authentication rather than a stored database password. Redis, S3 and Secrets Manager sit alongside the services inside the VPC that the stack creates, so check which of these subnets and security groups you need to keep private and which must stay reachable.
Request path through the load balancer, ECS services and the data stores inside the stack's VPC.
Which stack options fit which environment
This table compares the main configuration choices you face before running the LiteLLM AWS Terraform stack: VPC, database readers, database authentication, load balancer exposure and version pinning. Read each row against your network, data residency and change control requirements, then confirm the exact variable names and defaults in the vendor README before you commit.
| Choice | Fits when | Trade-off to weigh | Confirm in the README |
|---|---|---|---|
| Create a new VPC with the stack | The gateway is a dedicated workload with no existing network to join, or a separate sandbox or pilot account is acceptable | You take on routing, NAT, endpoints and peering decisions that your platform team may already govern elsewhere | Which networking resources the stack creates and how it exposes subnet and CIDR inputs |
| Reuse an existing VPC | Your organization has a landing zone with approved subnets, egress paths and shared logging that the gateway must follow | Subnet tagging, route tables and security groups must match what the stack expects, which adds review effort | Required subnet inputs, tagging expectations and whether the stack adds its own security groups |
| Aurora writer only | A pilot, low-traffic environment, or a team that accepts a single database endpoint and manual failover handling | Key lookups and spend queries share the writer, and a writer failure affects the whole gateway until recovery | Whether a single writer instance is the default and how instance class is set |
| Aurora writer and reader | Production traffic where key lookups and spend queries must keep working through a reader and the team wants a read path separate from writes | Extra instance cost and the need to wire reader use into application settings, which the stack may not do for you | How the reader is provisioned and whether the gateway is configured to use the reader endpoint |
| IAM database authentication | Your security standard prefers short-lived credentials and centralized identity for database access | Token refresh, IAM policy scoping and debugging connection failures add operational work | Which IAM settings the stack creates and how the gateway obtains database tokens |
| Password-based database access | A tightly scoped test environment, or a platform where IAM auth cannot be enabled yet | Password rotation and storage in a secret store become your responsibility, and audit trails show less identity detail | Where the password is generated, how it reaches Secrets Manager and the rotation options supported |
| Internal Application Load Balancer | Only staff or internal services call the gateway, and access comes through a private network, VPN or private DNS | Developers outside the network need a gateway path, and certificate and DNS work still applies | Whether the load balancer scheme is a setting, and how TLS certificates are supplied |
| Internet-facing Application Load Balancer | External partners or distributed teams must reach the gateway directly and you have controls such as allowlisting in front of it | A larger exposure surface that needs WAF, allowlists, TLS policy and monitoring from day one | Scheme options, listener configuration and any built-in access controls the stack provides |
| Pin the module to a fixed version | Change control requires reviewed upgrades, and image tags must be tested before production | You must track upstream releases and schedule upgrades yourself, including database migration steps | The version constraint syntax, the image version the module deploys and the upgrade notes for each release |
| Track a floating module reference | A sandbox where fast feedback on upstream changes matters more than repeatable deployments | A plan can change image versions without a review step, which conflicts with most production change policies | Whether the module publishes tagged releases you can pin to |
How to stand up the stack in your AWS account
This sequence takes the LiteLLM AWS Terraform stack from account readiness to a verified gateway with a load balancer, Aurora PostgreSQL, Redis and admin sign-in in your own AWS account. Each step names who does the work and the check that confirms it is complete.
Confirm prerequisites and review network and IAM
Your cloud or platform team confirms the AWS account, the Terraform version and the credentials used to apply the stack, and reviews the IAM permissions that Terraform needs to create ECS, Aurora, ElastiCache, S3, Secrets Manager and load balancer resources. The network review confirms that the VPC address range the stack creates does not overlap with networks you peer or route to. Done when a reviewer has signed off on the IAM policy and the address plan, and a dry run of Terraform authentication succeeds against the target account.
Pin the stack and gateway image versions
Check out a specific release of the LiteLLM repository and use the AWS stack from that tag, rather than the moving main branch, so every apply produces the same infrastructure. Pick a release from one of the four most recent stable minor lines that LiteLLM supports. The releases page lists v1.105.1, published October 14, 2026, at the time of writing, but confirm the current list before choosing. Record the tag and the image it deploys in your change record. Done when the repository is at the tagged commit and the image reference in your configuration matches that tag.
Review the plan before creating the VPC and data stores
Run a Terraform plan and read every resource it will create, including the VPC, subnets, the Aurora PostgreSQL writer and reader, the ElastiCache Redis cluster, the S3 bucket, the Secrets Manager entries, the ECS services and the Application Load Balancer. Confirm that the database uses IAM authentication, that a reader instance is present, and that no resource is publicly reachable unless you intended it. Confirm the Redis engine version is 7.0 or newer, since a multi-instance gateway needs it for shared state. Done when the plan matches your approved design and the reviewer has recorded any changes to make before apply.
Store LITELLM_MASTER_KEY in Secrets Manager
Generate the master key outside the repository and store it in AWS Secrets Manager under a name the stack reads. The value of LITELLM_MASTER_KEY must start with sk-. Restrict read access to the ECS task role and to the administrators who manage the gateway, and keep the value out of Terraform variable files, shell history and CI logs. Record the secret name and its rotation owner in your runbook. Done when the secret exists, its resource policy grants only the intended principals, and a test retrieval from the task role's identity succeeds without exposing the value in logs.
Apply the stack and capture its outputs
Run the apply step from the reviewed plan file, not a fresh plan, so that what runs is what was reviewed. Aurora and ElastiCache take the longest to provision, so expect the apply to run for some time and keep the session under monitoring. Save the load balancer address, database endpoints and Redis endpoint from the outputs into your configuration store. Done when Terraform reports a successful apply with no failed resources and the ECS services show as running tasks in the target cluster.
Verify the ALB health endpoint
Find the health check path that the stack README documents and confirm it against the README for the release you pinned. Send a request through the load balancer address and check the response code and body. Also check the target group in the console or CLI, where each ECS task should report healthy. Done when the endpoint returns a success response through the ALB and every registered target is healthy. If targets stay unhealthy, check the task logs before changing security groups.
Verify database connectivity with IAM authentication
Confirm that the gateway connects to the Aurora writer and that the reader endpoint is reachable from the task role. Check the task logs for database connection errors, and confirm that the proxy starts without a password in its configuration, since IAM authentication is the intended path. Make a test request that writes a record, such as a key or spend entry, and confirm it appears in the database. Done when the gateway logs show a successful connection, a test write persists, and the task role's IAM policy is the only credential source in use.
Verify Redis connectivity and admin UI SSO
Confirm from the task logs that the gateway connects to the ElastiCache endpoint and that cache and rate-limit operations succeed when you send two test requests through the load balancer. Then sign in to the admin UI with your identity provider, choosing Google, Microsoft Entra ID, Okta or a generic OIDC provider. Note that SSO is free for up to 5 users from v1.76.0, and that more users require an Enterprise license. Done when both checks pass, a test administrator signs in through SSO, and the results are recorded with the release tag and the stack outputs.
How module versions drive LiteLLM image upgrades
The LiteLLM Terraform stack ties the running gateway release to the version of the module you deploy, so upgrading the module is an upgrade of LiteLLM itself. Before you bump the module version in your configuration, read the module's change history and the LiteLLM release notes for every minor version between your current release and the target. Confirm which container image tag the new module version pins, and whether you can override that tag in your own variables. Treat a module upgrade as a change to the gateway's code path, not as an infrastructure-only change, and record the before and after image tags in your change ticket.
LiteLLM supports the four most recent stable minor versions for both open source and Enterprise deployments, so your target should sit inside that window at the time of the change. The current GitHub release listed is v1.105.1, published October 14, 2026, but confirm the latest release on the day you plan the work, since the window moves with each new minor version. If your stack is several minor versions behind, plan intermediate steps rather than jumping directly, and check the release notes for any database migration that must run in a specific order. Also confirm that the Aurora PostgreSQL writer and the ECS task definition change together, because a new task can start against an unmigrated schema.
Run the upgrade first in a non-production environment built from the same module version, with a copy of production-like data where your policies allow it. Apply the database migration as its own step, verify that the new tasks pass health checks through the Application Load Balancer, and exercise virtual keys, budgets, routing and logging with test traffic. Keep the previous task definition available so you can roll back the service, and note that rolling back the image does not reverse a schema change, so confirm with the release notes whether the migration is backward compatible. Promote to production only after the non-production run is clean and the rollback path has been tested.
Security controls to set in the AWS stack
The AWS stack places the gateway, its database, cache, object storage and secrets in your account, so most of the security posture comes from how those pieces are wired together. The cards below cover the controls to review before the first production request, and each one names what to check in your own environment.
Master key in Secrets Manager
The LITELLM_MASTER_KEY controls administrative access to the proxy, and it must start with sk-. Confirm that the key is stored in AWS Secrets Manager rather than in task definitions or Terraform state in plain text, that only the ECS task execution role can read it, and that the rotation process is written down before go-live. Check who in your organization can read the secret through the console or API.
Production guideLeast-privilege Aurora IAM access
The stack connects to Aurora PostgreSQL with IAM authentication, so no static database password needs to live in the task. Review the IAM policy attached to the task role and confirm it grants only the database connect action for the specific database user and cluster, not wildcard resources. Confirm that the database user is limited to the schema LiteLLM needs and that human administrators use separate accounts.
ALB exposure and security groups
Decide which networks can reach the Application Load Balancer and whether it faces the internet or only your internal network. Review the security groups so that ECS tasks accept traffic only from the load balancer, the database accepts connections only from the task security group, and Redis is reachable only from the tasks. Confirm that the listener uses TLS with a certificate you control and that inbound rules are documented for your network team.
S3 bucket access and encryption
Review which S3 buckets the stack creates and what the gateway writes to them. Confirm that public access is blocked at the bucket and account level, that default encryption is enabled with a key policy your security team approves, and that the task role can only read and write the prefixes it needs. Check whether request or response payloads reach S3 in your configuration, since that decides how sensitive the bucket contents are.
Logging and audit trails
Decide where ECS task logs, load balancer access logs and database audit records go, and how long each store is kept. Confirm that log groups have retention set rather than the default of never expiring, that access logs are written to a bucket with restricted access, and that CloudTrail covers changes to the secret, IAM roles and database. Test that an administrative action on the proxy can be traced to a person.
Image provenance for the pinned release
The module pins a LiteLLM release, and that version decides which container image runs in your account. Record the exact image tag and digest your deployment pulls, compare it with the release notes on the LiteLLM releases page, and confirm that your pipeline scans the image before it reaches ECR. Repeat this check each time you change the module version, because an upgrade changes the code that handles every request.
LiteLLM releasesRunning the stack after the first deploy
Once the stack is up, the recurring work is watching the ECS service, the Aurora cluster and the Redis layer together, because the gateway's health depends on all three. Track ECS task health and restarts on the Application Load Balancer target group, and watch Aurora writer CPU, connection count and replica lag. Spend writes land on the primary, so write load and connection growth are the first signals to alert on. Scale the gateway by changing the ECS task count rather than adding Uvicorn workers inside each task, since LiteLLM's guidance is one worker per container and horizontal scaling. Confirm the Redis memory and eviction metrics as well, because shared rate limits, cooldowns and cache state live there once more than one task runs.
Spend updates are batched to the database every 60 seconds at scale. That means spend shown in the admin UI or fed to budget checks can trail real traffic by up to a minute, and a short burst can be counted late. Plan budget enforcement and chargeback reports around that lag, and test a budget limit in staging before relying on it for cutoffs. Rotate LITELLM_MASTER_KEY and other secrets in Secrets Manager on a schedule you define, then force a new ECS deployment so tasks pick up the new value. Confirm with your security team how rotation interacts with virtual keys already issued, since the master key is separate from them.
Plan each LiteLLM version change against the migration path in the release notes and the four-minor-version support window described in the enterprise documentation. Test the new image tag in a non-production stack built from the same module version, then apply the migration in a planned window. Take a manual Aurora snapshot before the change and confirm Aurora automated backup retention and point-in-time recovery settings meet your recovery targets. For S3, confirm versioning and lifecycle rules on the buckets the stack uses, and restore-test at least one object. Ask your partner or team to document the restore steps, because a backup that has never been restored is an unverified control.
Questions buyers ask before deploying LiteLLM on AWS
What does a LiteLLM deployment on AWS cost, and what drives the price?
No price list applies here: DeployOpen publishes no price list, and a quote follows from a written scope. The cost has two parts. One part is the engagement itself: design, Terraform work, VPC integration, identity and SSO setup, network review and testing. The other part is the AWS bill for the stack, which recurs monthly and depends on the Aurora PostgreSQL instance classes, ElastiCache node sizes, Fargate task counts and sizes, load balancer usage and S3 storage. The biggest effort drivers are whether you want the stack to create its own VPC or join an existing one, how your identity provider is wired in, how much your network team must review, and how much testing your controls require. Ask for the quote to list each of these separately, with the AWS resources it assumes.
How long does a LiteLLM deployment on AWS take?
Duration depends on scope and on how quickly your AWS accounts, IAM roles and network decisions are settled. A single-account stack that creates its own VPC and uses a standard SSO provider takes less time than a deployment that joins existing subnets, needs multiple environments, or must pass a network security review first. Testing and hardening are separate phases that add time when your controls require evidence. No duration figure is supplied for this work, so ask for a timeline in the written scope, with milestones for environment access, first deployment, identity testing, load testing and handover.
What must our team provide before the engagement starts?
Most delays come from missing inputs rather than from the build. Plan to provide:
- AWS accounts for each environment, with an agreed region and account guardrails
- IAM roles or permission boundaries that the deployment role can assume, and a decision on who approves IAM changes
- Network decisions: whether the stack creates its own VPC or uses yours, CIDR ranges, DNS names, and whether the load balancer is internal or internet-facing
- An SSO provider and the admin group that will own LiteLLM access
- Named owners for secrets, backups and sign-off on the written scope
Confirm these items in the scope document before work begins.
Can our own platform team run this LiteLLM stack after handover?
Often yes, if your team already runs Terraform, ECS, Aurora and IAM in production. Running the stack requires routine work: applying module upgrades, reviewing image changes, watching database and Redis capacity, rotating keys in Secrets Manager and handling incidents. The LiteLLM Terraform stacks README describes how the gateway, backend and UI run on ECS Fargate with Aurora PostgreSQL, ElastiCache, S3 and an Application Load Balancer. Ask DeployOpen for a handover plan that names which runbooks your team will own, and assess honestly whether your team has the AWS and LiteLLM skills to do that work without a partner.
Is the official AWS Terraform stack supported for production use?
The stack is published by the LiteLLM project in its repository, and the LiteLLM production guide names PostgreSQL as the primary supported database and recommends Redis 7.0 or newer once more than one proxy instance runs. LiteLLM maintains support for the four most recent stable minor versions, and the latest release listed on its releases page is v1.105.1, published October 14, 2026. Whether a given module version meets your production requirements depends on your own testing and on what your auditors expect. Confirm the module version, the image version it pins, and the support status of that line with the vendor before you commit.
What does a LiteLLM deployment on AWS need to keep running after go-live?
Recurring work includes:
- Updating the Terraform module and the LiteLLM image, which should stay on a supported minor version
- Patching and upgrading Aurora PostgreSQL and ElastiCache as AWS releases engine updates
- Monitoring Fargate tasks, database connections and Redis memory
- Rotating LITELLM_MASTER_KEY and other secrets held in Secrets Manager
- Reviewing backups, restore tests and access to the admin UI
- Responding to security patches and incidents
Retainers can cover upgrades, support and continuous testing. Ask for these in the quote as separate line items so the recurring cost is visible.
What security and compliance evidence does the AWS deployment produce?
DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform those. For this deployment, the evidence typically includes IAM policies, network diagrams, encryption settings for Aurora, ElastiCache and S3, secret handling in Secrets Manager, SSO configuration and logging. Ask the written scope to list each artifact your assessors will request, and confirm with your auditor which controls they expect to see evidenced.
Official sources for the AWS stack and LiteLLM production guidance
Before you apply the AWS stack, read the stack README in the LiteLLM repository, because it defines what the Terraform creates: the gateway, backend and UI on ECS Fargate, Aurora PostgreSQL with a writer and reader and IAM authentication, ElastiCache, S3, and an Application Load Balancer, plus a VPC the stack builds for itself. Read it against your own network plan. If you already run a VPC with routing, DNS and egress rules your security team has approved, decide early whether the stack's own VPC is acceptable or whether you need to adapt the modules. Confirm the README version you are reading matches the module version you intend to pin, since the stack changes between releases. Read it in the Terraform stacks README alongside the input variables it exposes.
The second source is the LiteLLM production guide, which sets the expectations the stack must meet once traffic arrives. It names PostgreSQL as the primary supported database, requires Redis 7.0 or newer once more than one proxy instance runs for shared rate limits, router state and cache, and suggests 1 vCPU and 4 GiB memory per worker. It also recommends one Uvicorn worker per container, horizontal scaling, keeping LITELLM_MASTER_KEY (which must start with sk-) in a secret manager, and batching spend updates every 60 seconds at scale. Map each recommendation to a setting in the Terraform inputs and record any gap as a decision for your team. Ask the partner or your own engineers to confirm which of these values the module sets by default and which you must override.
How DeployOpen scopes and delivers a LiteLLM AWS deployment
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside the client's own AWS accounts. For a LiteLLM gateway on ECS Fargate, we agree the scope, the Terraform changes and the handover evidence in writing before work starts.
How we scope
- Confirm the AWS accounts, regions and VPC layout where the stack will run, including whether the module's own VPC fits your network design.
- List which model providers, private model backends and identity sources the gateway must reach, and record the egress each one needs.
- Agree in writing how the Aurora PostgreSQL writer and reader, ElastiCache Redis, S3, Secrets Manager and load balancer are sized and owned.
How we build
- Apply the LiteLLM Terraform stack to a non-production account first, then review each resource it creates against your tagging, encryption and IAM standards.
- Configure Aurora IAM authentication, Secrets Manager entries for the master key and provider credentials, and load balancer listener settings to match your certificate policy.
- Test the module upgrade path by pinning module and image versions, rehearsing an image change and confirming database migrations complete before production rollout.
How we hand over
- Deliver Terraform code in your repository with a README covering variables, state location, ownership of each AWS resource and the upgrade procedure.
- Document verification results for access paths, logging and secret handling so your security and compliance teams can review the evidence themselves.
- Walk your platform and security teams through daily checks, rollback steps and the list of items to confirm with your auditors before go-live.
How we support
- Fixed-scope engagements end with the agreed deliverables, and any follow-on work is quoted separately from the written scope.
- Ongoing support, upgrades and continuous testing are available as a retainer for teams that want DeployOpen to track new LiteLLM releases.
- Ask any partner to confirm the LiteLLM release line they support, how module upgrades are tested and who is on call for production incidents.

