Blog

How to Self-Host Twenty CRM on AWS: Official Docker Compose Setup, Backups and Upgrades

December 4, 2026

Twenty is an open-source CRM that you can run in your own AWS account, so your customer records sit in a database you control. This guide walks through the official Docker Compose setup, then covers the AWS pieces around it: the server, storage, backups, a domain with HTTPS, and upgrades. It follows Twenty’s own documentation, read on 4 December 2026, and points to the exact page for each step.

Twenty is released often and its guides change, so treat the linked pages as the source of truth. Where this article goes beyond Twenty’s documentation, such as the choice of AWS services, we say so.

The short version

  • Twenty’s official self-host method is Docker Compose. It runs the Twenty server and worker, PostgreSQL and Redis.
  • The only stated minimum is 2 GB of RAM, plus Docker and Docker Compose. Twenty does not state CPU or disk figures, so size beyond that from your own use.
  • Keep it private. Twenty’s guide recommends a reverse proxy with HTTPS and says most teams can keep the app private and open only a few paths.
  • Back up the database and the encryption key. Losing the key means losing every stored secret.
  • Upgrade by changing one tag, after taking a database backup.

1. Before you start: what you are taking on

Twenty’s repository had 61,871 stars on 4 December 2026. The core is licensed under the AGPL v3. Some files are under a commercial enterprise licence, and some packages are MIT. Running the open part for your own team is straightforward. Features that need the enterprise licence need a subscription from Twenty. Under the AGPL, if you modify Twenty and let others use it over a network, you must offer them your modified source. Read the licence file before you decide. This is not legal advice.

Self-hosting also means you own the operations: patches, backups, restores and access control. Twenty’s own security guide explains why this matters. When a security fix ships, the fix itself shows attackers where to look, and every instance that has not upgraded becomes a target. If nobody on your team can own that, a hosted CRM may be the better choice. For the wider picture, see our guide to self-hosting open-source business apps on AWS.

2. What the official setup runs

Twenty’s Docker Compose guide installs four containers from the compose file in the Twenty repository:

  • server, the Twenty application, listening on port 3000.
  • worker, which runs background jobs.
  • db, PostgreSQL 16, with its data in a Docker volume.
  • redis, used for caching and queues.

Two Docker volumes hold your data: one for the database and one for files the server stores locally. If you deploy to a stateless environment, Twenty’s guide says you must configure external storage instead. Twenty warns that you should only change settings the guide mentions, because other changes can break the setup. Advanced settings are listed on its environment variables page.

3. Requirements and sizing on AWS

Twenty’s documented system requirements are short:

  • RAM: at least 2 GB. The guide warns that insufficient memory can cause processes to crash.
  • Software: Docker and Docker Compose, both installed and up to date.
  • CPU and disk: not stated.

Our AWS suggestions on top of that. Twenty runs four containers on one server, so 2 GB is a floor, not a target. Pick an EC2 instance with comfortably more memory than that and watch real usage in your first weeks. Compare instance types and prices on the AWS instance types page. Use an EBS volume for the operating system and Docker data, and size it for your records and attachments. A Linux distribution with a current Docker Engine is the usual choice; Twenty does not name one.

Twenty on one AWS serverYour team reaches a reverse proxy or load balancer over HTTPS, which forwards to the Twenty server and worker containers, which use PostgreSQL and Redis on EBS storage. Database dumps are copied to Amazon S3.Your teamone hostname over HTTPSReverse proxy or load balancerTLS certificate, firewall rulesTwenty server and workerDocker Compose on EC2, port 3000PostgreSQL and Redisdata on an EBS volumeBackups in Amazon S3database dumps and the .env file

4. Install Twenty with Docker Compose

First launch an EC2 instance, open only the ports you need in its security group (see section 5), and install Docker Engine with the Compose plugin. Then choose one of Twenty’s two methods.

Option 1: the one-line script

Twenty’s guide gives this command to install the latest stable version:

bash <(curl -sL https://raw.githubusercontent.com/twentyhq/twenty/main/packages/twenty-docker/scripts/install.sh)

To pin a version, set VERSION to a full release tag published on Docker Hub, for example v2.38.1. The guide says aliases such as v2 or latest are not accepted. If you would rather read what a script does before running it, use the manual steps.

Option 2: the manual steps

These are the steps from Twenty’s guide, in order:

  1. Get the environment file. curl -o .env https://raw.githubusercontent.com/twentyhq/twenty/refs/heads/main/packages/twenty-docker/.env.example
  2. Generate an encryption key with openssl rand -base64 32, then uncomment ENCRYPTION_KEY in .env and set it. Keep it secret. Twenty’s guide says losing it means losing access to every secret stored in the database, such as OAuth tokens and two-factor secrets.
  3. Set the database password. Uncomment PG_DATABASE_PASSWORD and use a strong password without special characters. Twenty says the password goes into the connection URL unencoded, so characters such as @, /, # and % break it. openssl rand -hex 32 produces a safe one.
  4. Get the compose file. curl -o docker-compose.yml https://raw.githubusercontent.com/twentyhq/twenty/refs/heads/main/packages/twenty-docker/docker-compose.yml
  5. Start it. docker compose up -d
  6. Check it. On a server, run curl http://localhost:3000 to confirm it responds.

Two cautions from Twenty’s guides. Keep SERVER_URL set, because the compose file passes it through without a default and the server treats an empty value as configured. And choose the database password before first start: the password is stored in the database volume on first run, so changing it later without removing the volume causes “password authentication failed” errors. Twenty’s troubleshooting page explains the fresh-install fix, which deletes the database, so use it only on a new installation.

5. Domain, HTTPS and keeping it private

What Twenty says. By default Twenty answers on port 3000. Twenty’s guide strongly recommends putting it behind a reverse proxy with SSL termination, and says some browser features, such as copy buttons, may not work without HTTPS on a normal domain. Set SERVER_URL in .env to the address people use, for example https://crm.example.com, then restart with docker compose down and docker compose up -d. The server uses it for links in emails, for OAuth callbacks and to detect HTTPS. It must match how users reach the app in their browsers.

Keep it private by default. Twenty’s Securing your instance guide splits the instance into zones. Almost everything (the app, /graphql, /rest, /metadata and files) should be reachable by your team only. A few paths, /webhooks, /s and /emailing, may need to be public for services that cannot join your network, and separate paths exist for cloud AI connectors. The guide describes three ways to do this: Tailscale, Cloudflare Tunnel with Access, or your own reverse proxy (Caddy or Nginx) with IP allowlists. It says not to make /graphql or /rest public, because the app itself runs on them.

On AWS. These choices are ours, not Twenty’s:

  • A reverse proxy on the same instance. Follow Twenty’s Caddy or Nginx examples, bind Twenty to 127.0.0.1:3000 as the guide shows, and open only port 443 in the security group, limited to your office or VPN addresses if you can.
  • An Application Load Balancer in front. Terminate HTTPS on the load balancer with a certificate from AWS Certificate Manager and forward to port 3000. The instance’s security group should then accept port 3000 only from the load balancer’s security group. Because the proxy is no longer on the same host, the localhost binding does not apply, so the security group does that job.
  • A domain. Create a DNS record for the hostname you chose, pointing at the load balancer or the instance’s Elastic IP.

If you use n8n for automation, Twenty’s guide says self-hosted n8n inside your network works well against a private instance, while hosted automation tools cannot reach it. See our n8n on AWS guide.

6. Backups and restores

Twenty’s guide gives these commands. They assume the database container is called twenty-db-1, so check yours with docker ps.

# Create a backup
docker exec twenty-db-1 pg_dump -U postgres default > backup_$(date +%Y%m%d).sql

# Daily at 02:00 (crontab -e)
0 2 * * * docker exec twenty-db-1 pg_dump -U postgres default > /backups/twenty_$(date +\%Y\%m\%d).sql

# Restore
docker compose stop server worker
docker exec -i twenty-db-1 psql -U postgres default < backup_20240115.sql
docker compose up -d

Twenty’s backup advice: test restores regularly, store backups off-site in cloud storage such as S3, encrypt them, and keep daily, weekly and monthly copies.

On AWS (our suggestions): copy each dump to a private Amazon S3 bucket, using an IAM role on the instance rather than stored keys, and turn on bucket encryption and versioning. Also take regular EBS snapshots of the volume. Store a copy of your .env file, which holds ENCRYPTION_KEY, in a separate secure place. A database dump is of little use without the key that decrypts the secrets inside it.

7. Upgrades

Twenty’s upgrade guide says to always back up first. Its backup command for upgrades is:

docker exec -it {db_container_name_or_id} pg_dumpall -U {postgres_user} > databases_backup.sql

Then, with Docker Compose:

  1. Stop Twenty: docker compose down
  2. Change the TAG value in the .env file next to your docker-compose.yml
  3. Start Twenty: docker compose up -d

The server runs the required upgrade migrations automatically on startup. Some points from the guide worth knowing:

  • From v2.34, Twenty needs PostgreSQL 15 or newer. The official compose file uses PostgreSQL 16. This matters only if you connect to an external database.
  • From v1.23, you can jump straight from any supported version to the latest. Older instances must step through each version up to v1.23 first.
  • Set a dedicated ENCRYPTION_KEY before upgrading to v2.5 or later, so the one-time backfill of stored secrets uses it from the start.
  • If an upgrade fails on some workspaces, the server will not move past that step. Restart to retry, and run yarn command:prod upgrade:status --failed-only inside the server container to see the errors.

Pin a specific version tag in TAG rather than following the newest one, and read the release notes before each upgrade. Twenty also has a key rotation guide for rotating ENCRYPTION_KEY.

8. How IHA Cloud can help

IHA Cloud can set up and manage Twenty in your AWS account. You keep the data and the AWS bill is yours, and we take on the routine work. That can include:

  • Setup. A server, storage, domain and HTTPS built from Twenty’s official method. See application and web hosting.
  • Database and backups. Dumps to S3, snapshots and restore checks, and moving data in from another CRM. See database management and migration.
  • Upgrades and monitoring. Backup before upgrade, version pinning and routine checks. See DevOps as a service.
  • Locking it down. A review of which paths are public, who can reach the instance and where secrets live. See security audit.

If you are not sure whether self-hosting fits your team, ask for a free consultation.

9. Checklist before you go live

  • The instance has more than the 2 GB RAM minimum, and a sized EBS volume.
  • ENCRYPTION_KEY and PG_DATABASE_PASSWORD are set before first start and saved somewhere safe.
  • SERVER_URL is your HTTPS address.
  • Only the paths and addresses you intend can reach the instance.
  • A backup runs daily, is copied off the server, and you have restored from it once.
  • You know who upgrades Twenty, how often, and where the version is pinned.

Related reading: Self-Host Open-Source Business Apps on AWS, How to Self-Host n8n on AWS and Open Source CRM Software.

IHA Cloud is a brand of Team IHA INC. This guide summarises Twenty’s official documentation and repository as read on 4 December 2026. It is not legal advice and not a substitute for Twenty’s documentation. Commands, versions and requirements change between releases, so check the linked pages before you run anything.

IHA Cloud · Blog

Talk to our cloud experts

care@ihacloud.co · +1 (888) 447-4762