Paytm Architecture Explained: How Paytm Runs Payments on the Cloud
Short answer: Paytm runs mainly on AWS. In 2022 Paytm had 100+ AWS accounts, thousands of servers, petabytes of cloud storage and thousands of microservices, and also uses Azure and Google Cloud. Services run on EC2 Auto Scaling groups behind ALBs, with many Spot instances. Payment databases use a Paxos consensus setup across data centres so every transaction is stored on most machines. Caching uses Redis, monitoring uses Prometheus and Thanos.
Suppose you recharge your mobile on Paytm
You recharge your prepaid mobile for 299 rupees on Paytm in Lucknow. In simple terms:
- Your app's request reaches an Application Load Balancer on AWS.
- The ALB sends it to a microservice running on EC2 instances in an Auto Scaling group.
- Session and hot data come from Redis clusters.
- The payment is recorded in a database cluster that uses Paxos, so it is safely written on the majority of machines in different data centres.
- Metrics from each service are collected by Prometheus and shown to Paytm's operations centre.
- Later, the transaction data flows into Paytm's data platform on Amazon EMR and S3 for reports.
All of this happens in a few seconds. Paytm accepts payments from Paytm Wallet, Paytm Postpaid, UPI, netbanking and cards, and each business (for example IoT payment devices in stores or merchant account status) has its own database cluster, sized for unpredictable reads and writes.
What architecture style does Paytm use?
Paytm (22 to 2023) shows a large microservices estate on AWS.
- Thousands of microservices across 100+ AWS accounts and 100+ business verticals (2022).
- Canary deployments: Jenkins builds, AWS CodeDeploy rolls out to canary and live target groups behind the ALB, with Spot instances handled gracefully.
- Cost control: Paytm built the Paytm Optimizer tool to track cloud cost and move Auto Scaling groups to Spot safely.
- Strong databases: sharding, a single-leader Paxos design and InnoDB tuning for payment data (2022).
Paytm architecture diagram (public parts)
This diagram shows only what Paytm or its partners have shared publicly. Press Play to follow a request step by step.
- You start a recharge.
- An ALB on AWS receives it.
- A microservice on EC2 handles it.
- Session data comes from Redis.
- The payment is stored with Paxos replication.
- Builds and long-term metrics live in S3.
- Prometheus and Thanos collect metrics.
- Data later flows to EMR for reports.
- Recharge successful.
What does Paytm use? Main technologies
| Layer | What Paytm uses (public) | What it does in simple words |
|---|---|---|
| Cloud | AWS (also Azure, Google Cloud) | Hosts Paytm services |
| Compute | EC2 Auto Scaling groups, Spot, Kubernetes | Runs microservices |
| Deploys | Jenkins + AWS CodeDeploy | Canary and live rollouts |
| Database | Sharded, Paxos-replicated, InnoDB | Payment records |
| Cache | Redis clusters | Fast reads |
| Monitoring | Prometheus, Thanos, Grafana | Metrics and alerts |
| Data | Amazon EMR, S3, Spark | Reports and analytics |
Which cloud provider does Paytm use?
Paytm uses AWS as its main cloud. As of 2022 Paytm uses the clouds AWS, Azure and Google Cloud, with 100+ AWS accounts. The setup meets data localisation and compliance rules.
How does Paytm deploy new code safely?
Since 2022 Paytm uses a canary rollout on AWS:
- Jenkins builds the code and packages it with an appspec file.
- The build is uploaded to S3.
- New canary instances are launched in their own Auto Scaling group and target group.
- Health checks run on the canary; if healthy, it is made active in the ALB, which splits traffic between canary and live target groups.
- Engineers watch the canary, then approve the live rollout or abort and roll back.
- On Spot instances, a small system process checks the AWS metadata API for interruption notices and stops the app gracefully before AWS takes the machine back.
The Paytm Optimizer (2022) adds a scheduler that predicts Spot interruptions from data across thousands of instances, so large Auto Scaling groups can safely use Spot in both peak and non-peak hours.
How it started: on-premises data pipeline
- Paytm's central data pipeline once ran on premises on a proprietary system; jobs took 8 to 10 hours.
- A 10-engineer team moved it to Amazon EMR, S3 and Spark in about four months, cutting job times to 20 to 30 minutes and using an 80:20 Spot to On-Demand ratio.
- Monitoring moved from paid tools to open-source Prometheus.
How does Paytm store data?
- Payment databases: sharded clusters with Paxos consensus and InnoDB.
- Redis: main cache layer across hundreds of AWS accounts (2023).
- S3: build artifacts, long-term metrics and the data lake.
- The current main database product names are not publicly shared.
How does Paytm monitor its systems?
- Prometheus with EC2 and Kubernetes service discovery.
- Thanos as global query layer, metrics stored long-term in S3.
- Alertmanager sends alerts to Slack, MS Teams, PagerDuty and email; a NOC watches a single view.
If we built an app like Paytm on AWS (illustrative)
Please read this first
This section is a learning design by Ravindra Bagale. It is not Paytm's real setup. Paytm really runs mainly on AWS. We use AWS here because it is what you learn in the AWS course.
Suppose you want to build "BillBhai", an app to pay electricity and mobile bills. Here is a simple AWS layout.
1. Network: VPC, subnets, route tables, gateways
- Create one VPC with CIDR
10.0.0.0/16in the Mumbai region (ap-south-1). - Use two Availability Zones (A and B), so one AZ failing does not stop the app.
- In each AZ make three subnets: public (load balancer, NAT gateway), private app (your code) and private data (databases, cache).
- Attach one internet gateway (IGW) to the VPC. Public route table:
0.0.0.0/0 → IGW. This route is what makes a subnet public. - Private app route table:
0.0.0.0/0 → NAT gateway, so servers can download updates but nobody can connect in from the internet. - Private data route table: only the local VPC route. Use VPC endpoints to reach S3, DynamoDB and SQS without going over the internet.
2. Compute: where the code runs
- ALB with canary target groups.
- Services on EKS (or EC2 Auto Scaling groups like Paytm).
- Use Spot for stateless services.
3. Storage and databases
- Aurora for the ledger.
- DynamoDB for history.
- ElastiCache for Redis for sessions; S3 for receipts.
4. Monitoring
- Amazon Managed Prometheus + Grafana, or CloudWatch.
- X-Ray traces.
Request flow diagram
Press Play. The numbered list below the diagram lights up with each step.
- You open BillBhai. Route 53 answers.
- Static files via CloudFront.
- From S3.
- API calls enter via the internet gateway.
- The ALB picks a pod.
- The bill-pay API runs.
- Session from ElastiCache.
- Ledger in Aurora; history in DynamoDB.
- Events to SQS FIFO.
- CloudWatch watches.
- Bill paid.
Paytm versus our AWS design
| Part | Paytm (public info) | Our AWS design |
|---|---|---|
| Cloud | AWS (+ Azure, GCP) | AWS |
| Compute | EC2 ASG + Spot, Kubernetes | EKS |
| Database | Paxos-replicated shards | Aurora |
| Cache | Redis | ElastiCache |
| Monitoring | Prometheus + Thanos | Managed Prometheus / CloudWatch |
Quick quiz: check what you learned
Which cloud does Paytm mainly use?
- AWS
- Oracle Cloud
- IBM Cloud
- Only own servers
Show answer
A. Paytm has 100+ AWS accounts.
Which consensus algorithm do Paytm's payment databases use?
- Bitcoin
- Paxos
- Gossip
- Round robin
Show answer
B. Paytm chose a single-leader Paxos design.
What does Paytm use for monitoring?
- Excel sheets
- Nagios only
- Prometheus and Thanos
- No monitoring
Show answer
C. Prometheus with Thanos and Grafana.
Where did Paytm move its data pipeline?
- Floppy disks
- Google Sheets
- A mainframe
- Amazon EMR and S3
Show answer
D. Paytm moved to Amazon EMR, S3 and Spark.
Learn it properly
Build the AWS parts yourself with these free guides and lessons:
- How to create a custom VPC with subnets, internet gateway and route tables
- Public vs private subnet in AWS · 3-tier architecture project on AWS
- How to launch an EC2 instance · Install the CloudWatch agent on EC2
- AWS course: What is a VPC? Default VPC vs custom VPC
- Related architectures: JioHotstar Architecture Explained: AWS EKS, Envoy, Multi-CDN Live · Zomato Architecture Explained: AWS, Microservices, DynamoDB, Kafka · Swiggy Architecture Explained: AWS, Kafka, DynamoDB and CloudFront · Zerodha Architecture Explained: Self-Hosted Go, PostgreSQL, AWS
- All famous app architectures explained