awswebsocketscost-estimationarchitecture

How much does it cost to run a real-time chat app?

A chat app with 10,000 concurrent WebSocket connections and 20 million messages a month costs about 977 dollars on AWS. Here is the breakdown, plus where managed WebSockets stop being cheaper than running your own.

The C3X Team··7 min read

Quick answer

A real-time chat app with 50,000 users, 10,000 concurrent WebSocket connections, and 20 million messages a month costs roughly 977 dollars a month on AWS using managed WebSockets, or about 0.0195 dollars per user. The connection layer is only 169 dollars of that (110 for connection-minutes, 60 for messages); the larger lines are the CDN at 281 dollars, the presence cache at 220 dollars, and the message store at 150 dollars. Managed WebSockets stay cheaper than a self-managed fleet up to roughly 25,000 concurrent connections, after which per-connection-minute pricing overtakes the cost of running your own servers.

Chat looks expensive because it is always-on. Every user holds an open connection, the server must know who is online, and messages fan out to multiple recipients. In practice the connection layer is the cheap part, and the money goes to the things around it: presence state, message history, and media delivery.

The workload we are pricing

Assume a team chat product in us-east-1 with 50,000 registered users, 10,000 concurrently connected at weekday peak and an average of 10,000 connections held around the clock across time zones. Users send 20 million messages a month; each message fans out to an average of three recipients, so roughly 60 million messages cross the connection layer. Message history is retained for 90 days. Users share files and images totalling 1 TB stored and 3 TB of CDN delivery a month. Offline users get push notifications.

The monthly breakdown

ComponentSpecificationMonthly cost
CDN for attachments3 TB egress plus 25M requests$281.00
Presence and session cache2 x cache.m6g.large at 0.151/hr$220.46
Message storeDynamoDB 20M writes, 200M reads, 300 GB$150.00
WebSocket connections438M connection-minutes at 0.25 per million$109.50
Logs and metrics200 GB ingest plus retention$105.00
WebSocket messages60M messages at 1.00 per million$60.00
Attachment storage1 TB S3 Standard plus requests$34.00
Message handlers20M Lambda invocations, 256 MB, 100 ms$12.33
Push notificationsSNS mobile push, 10M sends$5.00
Total$977.29

Connection-minutes, the metric nobody budgets for

Managed WebSocket APIs bill two ways: per million messages, and per million connection-minutes. The second one is the trap, because it accrues while nothing is happening. Ten thousand connections held for a full month is 10,000 times 43,800 minutes, which is 438 million connection-minutes, or 109.50 dollars at 0.25 per million. A user who opens the app and walks away for a week costs exactly as much as one chatting continuously.

This matters because it changes an optimization that seems obviously good. Keeping connections open for fast reconnects feels efficient, but if half your connections are idle for 20 hours a day, half your connection cost is buying nothing. An idle timeout of 10 minutes with fast reconnect on foreground can cut connection-minutes by 40 to 60 percent for a mobile-heavy user base, worth 40 to 65 dollars a month here and proportionally more at scale.

When to run your own WebSocket fleet

Concurrent connectionsManaged (connection-minutes plus messages)Self-managed fleet
10,000$169.50about $330 (4 x c5.large plus NLB)
25,000$334.00about $340 (4 x c5.large plus NLB)
50,000$607.50about $420 (6 x c5.large plus NLB)
200,000$2,250.00about $900 (12 x c5.large plus NLB)

A single c5.large at 62.05 dollars a month can comfortably hold 15,000 to 30,000 idle WebSocket connections with a well-tuned event-driven server, so a self-managed fleet has a high fixed cost and a very shallow slope. Managed WebSockets have almost no fixed cost and a linear slope. They cross around 25,000 concurrent connections. Below that, managed is both cheaper and less work. Above 50,000, the self-managed fleet is meaningfully cheaper, though you now own connection draining, sticky routing, and rolling deploys without dropping sessions.

The message store is the second decision

Ninety days of history for 20 million messages a month is 60 million messages, roughly 300 GB with indexes. On DynamoDB on-demand that is 75 dollars of storage plus 25 dollars of writes and 50 dollars of reads. The read number is driven by channel scrollback: every time a user opens a conversation, the client fetches the last 50 messages. Caching recent messages in the presence cache (already paid for) removes most of those reads, and is the reason the cache line is 220 dollars rather than the message store being 400.

If history retention grows to two years instead of 90 days, storage goes from 300 GB to 2.4 TB and the DynamoDB storage line goes from 75 to 600 dollars. Archiving messages older than 90 days to object storage at 0.023 per gigabyte, with a retrieval path for search, keeps that at about 55 dollars instead. Retention policy is a cost decision as much as a product one.

Unit economics

At 977 dollars for 50,000 users, chat infrastructure costs 0.0195 dollars per user per month, or 0.0000489 dollars per message delivered. For a product charging 8 dollars per seat, that is a quarter of one percent of revenue. The scaling risk is not messages, which are almost free, but concurrency and attachment volume, both of which grow with engagement rather than headcount. Price the architecture from Terraform against theresource catalog and model the connection-minute line at 2x and 5x concurrency before you need to.

FAQ

How much does it cost to run a real-time chat app?

About 977 dollars a month on AWS for 50,000 users with 10,000 concurrent WebSocket connections, 20 million messages fanning out to 60 million deliveries, 90 days of history, and 3 TB of attachment delivery. That is 0.0195 dollars per user per month. The connection layer itself is only 169.50 dollars; the cache, message store, and CDN are the larger lines.

How much do WebSocket connections cost on API Gateway?

Managed WebSockets bill 0.25 dollars per million connection-minutes plus 1.00 dollar per million messages. Ten thousand connections held continuously for a month is 438 million connection-minutes, or 109.50 dollars. The connection-minute charge accrues whether or not anything is being sent, so idle connections cost exactly as much as active ones.

When should I run my own WebSocket servers instead of managed?

Around 25,000 concurrent connections. Below that, managed WebSockets cost less than the fixed price of a redundant self-managed fleet. At 50,000 concurrent, managed costs about 607 dollars against roughly 420 dollars for six c5.large instances plus a network load balancer; at 200,000 concurrent the gap is 2,250 versus about 900. Self-managing means owning connection draining, sticky routing, and zero-drop deploys.

How do I reduce WebSocket connection costs?

Stop paying for idle connections. An idle timeout of around 10 minutes with fast reconnect when the app returns to foreground can cut connection-minutes by 40 to 60 percent for a mobile-heavy user base. Holding connections open for faster reconnects feels efficient but buys nothing if half of them are idle 20 hours a day, and connection-minutes accrue regardless of activity.

What does chat message storage cost?

Around 150 dollars a month for 60 million messages over a 90 day retention window on DynamoDB, split between 75 dollars of storage, 25 of writes, and 50 of reads. Reads are driven by scrollback, so caching recent messages removes most of them. Extending retention to two years pushes storage from 300 GB to 2.4 TB and the storage line from 75 to 600 dollars unless older messages are archived to object storage.

How does C3X help price a real-time architecture?

C3X reads your Terraform and prices the full stack against a live catalog, including the WebSocket API, cache nodes, message tables, and CDN distribution. For a workload where the dominant risk is concurrency growth rather than message volume, having the connection layer priced against your actual infrastructure definition makes it straightforward to model what 2x or 5x concurrency costs before it arrives.

What to do next

Model your concurrency cost before it arrives. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.

Try C3X on your own Terraform

Free and open source. No API key required. One command to install, one command to estimate.