Case study
Lepok
E-commerce and ERP with seasonal scaling: more capacity in peak season and lower costs in the off-season.

About the client
Retail: office supplies and computer equipment
Lepok operates in the office supplies and computer equipment segments, with brick-and-mortar stores, corporate sales and e-commerce, in a competitive market with strong seasonality.
In late 2018, the company reached a turning point: its ERP began to require more robust, elastic infrastructure aligned with modern architectures. The on-premises model, built on heavy CAPEX and limited by physical constraints, no longer kept pace with the business or offered predictability.
Leadership decided to shift infrastructure spending from CAPEX to OPEX in search of flexibility, scalability and financial control, and hired KXC to design and implement an AWS architecture that could support growth, reduce risk and prepare the company for what comes next.
The project began with migrating the e-commerce site and continued with a full migration of the ERP infrastructure, always focused on continuity, performance and alignment with strategic goals.
The challenge
Lepok runs physical stores, B2B sales and e-commerce, and its ERP, based on on-premises SQL Server, faced these problems:
- Extreme seasonality: demand triples during peaks such as back-to-school season (January and February in Brazil) and the end of the year. During those periods, CPU usage exceeded 95%, causing severe slowdowns and downtime.
- Lost orders: an estimated 20% during peaks, because slow or unavailable systems couldn't process orders.
- A rigid CAPEX model: infrastructure sized for peak demand sat idle (CPU below 20%) during the 9 low-demand months, at a fixed cost of R$ 15,000 (Brazilian reais) per month.
- Limited e-commerce: the static infrastructure couldn't scale out for seasonal campaigns.
- Unvalidated backups: backups went to local storage, with no formal restore testing. The actual RPO was unknown, and the estimated RTO was more than 6 hours.
- An unreliable VPN: the connection between the stores and the central server suffered frequent timeouts at the point of sale during sales peaks.
The solution
Phase 1: Assessment and an architecture for seasonal scaling
- Analysis of 12 months of SQL Server metrics to identify the peaks at 3x the baseline. Baseline: db.r6i.large; peak: db.r6i.xlarge.
- A 3-year TCO comparing CAPEX (on-premises hardware) and OPEX (AWS), showing 57% savings in off-peak costs. Peak demand requires scaling up to db.r6i.xlarge for 6 to 8 weeks a year.
- An elastic architecture: an Auto Scaling group in the application layer (Amazon EC2), a scalable RDS instance and a read replica for e-commerce during peaks.
Phase 2: Migration with AWS DMS
- AWS Schema Conversion Tool to analyze the ERP schema.
- AWS Database Migration Service with Full Load and CDC, for a migration with no downtime during sync.
- Migration completed before the October 2025 peak, to stabilize production ahead of the holiday season.
- Cutover in a 3-hour window in the early hours of a Sunday, with integrity validation (row counts and DBCC CHECKDB) and zero data loss.
Phase 3: AWS infrastructure with elastic scaling
- Amazon RDS for SQL Server Standard: db.r6i.large in normal operation, in Multi-AZ (primary in sa-east-1a and standby replica in sa-east-1b). During peaks, it scales up to db.r6i.xlarge with RDS Modify, in a scheduled maintenance window.
- Read replica: created during peaks to offload e-commerce queries and reports, isolating the read load from the ERP's OLTP workload.
- EC2 Auto Scaling group (Windows Server): scales from 2 to 6 instances when CPU usage exceeds 60% and scales back in after the peak.
- AWS Site-to-Site VPN (IPsec AES-256): an encrypted connection between the stores and the VPC, which eliminated timeouts at the point of sale.
- EBS gp3 with Storage Auto Scaling: storage grows when free space drops below 20%, with no manual intervention.
Phase 4: Seasonal scaling automation
- AWS Systems Manager Automation: "seasonal-scale-up" and "seasonal-scale-down" runbooks, triggered manually or on a schedule, that scale the entire stack up or down.
- Amazon CloudWatch Anomaly Detection: dynamic thresholds that adapt to the seasonal pattern, with no manual tuning.
- AWS Backup: 90-day retention during peaks and 30-day retention off-peak, with a manual snapshot before every scaling event.
- AWS Systems Manager Patch Manager: automated patching outside peak periods.

Results
The partnership between Lepok and KXC, now more than seven years old, transformed the company's technology environment. The main results were:
- E-commerce migrated to AWS, staying stable even during highly seasonal periods.
- ERP migrated with zero downtime, without interrupting critical operations.
- A modern, scalable architecture with Amazon RDS and AWS WAF, which improved performance, security and reliability.
- Ongoing cost optimization, including reviews to mitigate exchange rate swings.
- Continuous evolution, with tests of serverless and auto scaling architectures.
- Greater technology maturity, staying close to AWS events and best practices, with artificial intelligence as the next step.
Technology became a strategic business enabler, not just operational support.
Results and key performance indicators (KPIs)
| Indicator | Result | Notes |
|---|---|---|
| Order capacity at peak | 2,000 orders/hr | Before: 500/hr (a 300% increase). Beat the 1,500/hr target. |
| Off-peak infrastructure cost | R$ 6,500/month | Before: a fixed R$ 15,000/month (a 57% reduction). |
| Availability during the seasonal peak | 99.97% | Before: ERP down during peaks. Zero downtime during the late-2025 peak. |
| ERP query latency | Under 50 ms | Before: 190 to 230 ms. Improved with Performance Insights and rightsizing. |
| RTO after the migration | Under 5 min | Multi-AZ failover. Before: more than 6 hours. |
| RPO after the migration | Under 5 min | Log backups every 5 minutes. Before: unknown. |
| Orders lost to downtime | Close to 0% | Before: 15% to 25% during peaks. |
| 3-year TCO savings | 57% | Compared with the on-premises cost (hardware, maintenance, licenses and DBA). |
AWS services used
Migration
- AWS Database Migration Service
- AWS Schema Conversion Tool
- AWS Migration Hub
Database and compute
- Amazon RDS for SQL Server Standard Multi-AZ
- RDS read replica (seasonal)
- Amazon EC2 Windows Server (Auto Scaling group)
- Application Load Balancer
- Amazon S3 (backups and files)
Operations and security
- AWS Site-to-Site VPN (IPsec)
- Amazon CloudWatch with Anomaly Detection
- AWS Systems Manager (Automation and Patch Manager)
- AWS Backup (seasonal policies)
- AWS KMS (RDS, EBS and S3)
- Amazon VPC with security groups
More case studies
Book a call with one of our specialists
Fill in your details and the service you need. We'll get in touch to find a time that works for you.