Introduction:
In todayโs cloud-first world, migrating legacy or on-premise applications to the cloud is no longer optionalโitโs essential. Our team recently completed a cloud migration project for an e-commerce web application, where we designed and deployed a robust, secure, and scalable infrastructure using Amazon Web Services (AWS).
In this post, Iโll walk through the architecture, services used, and best practices we followed for this migration.
๐ฏ Project Objective:
The main goal was to migrate an existing e-commerce web application from an on-prem environment to AWS, while:
-
Implementing network and data security
-
Improving scalability and performance
-
Ensuring high availability and monitoring
-
Optimizing for cost-efficiency
โ๏ธ Cloud Architecture Overview:


Following AWS best practices and implemented a multi-tier architecture split across public, private, and database subnets, within a custom VPC.
๐น VPC & Subnets
1. CIDR block: 10.0.0.0/16
2. Public Subnets (ALB): 10.0.1.0/24, 10.0.6.0/24
3. Private Subnets (EC2): 10.0.60.0/24, 10.0.120.0/24
4. DB Subnets (RDS): 10.0.180.0/24, 10.0.240.0/24
5. Availability Zones: us-east-1a, us-east-1b
6. A NAT Gateway was set up to allow internet access for private instances without exposing them publicly.
๐ Security Implementation:
Security was a core part of this project. Hereโs what needs to be done:
โ Security Groups:
-
Load Balancer (sg_loadbalancer): Allow HTTP/HTTPS ingress and egress from internet.
-
Web Servers (sg_private): Allow traffic to port 80 and 443 from internet only the instances within the private subnet use NAT for abstracting themselves from internet and allow ingress and egress to port 3306 from sg_rds.
-
Database (sg_rds): Only allow MySQL traffic from EC2 in private subnet over port 3306.
โ Web Application Firewall (WAF):
-
Attached to ALB with both:
-
AWS-managed rule sets (Linux, PHP, SQLi)
-
Custom rule sets (e.g., BlockBadBots)
โ IAM & KMS:
-
Created fine-grained IAM roles and policies for EC2, ALB, CloudFront, WAF, and CloudWatch.
-
Used AWS KMS to encrypt:
i. RDS storage
ii. EC2 volumes
-
Secrets in Secrets Manager
-
CloudWatch logs and S3 buckets
๐ฆ Content Delivery & DNS:
-
Manually setup CloudFront CDN linked to an S3 bucket for static content (JS, CSS, images), ensuring low latency and high availability.
-
Route 53 used to manage DNS routing.
-
ALB configured with SSL certs from AWS Certificate Manager for HTTPS support and redirecting HTTP to HTTPS.
๐ง Application & Database Setup:
-
EC2 (Web Tier):
i. Instance Type: t4g.small (cost-efficient + ARM support)
ii. Hosted the app on Ubuntu 24.02 LTS
iii. Configured for scaling and metrics collection via SSM & CWAgent
-
RDS (Database Tier):
i. Engine: MySQL
ii. Instance Type: db.t4g.medium (I/O optimized)
iii. Multi-AZ enabled for high availability
iv. Private access only (secured by sg_rds)
-
Secrets Manager used to store DB credentials and endpoint
๐ Monitoring & Cost Control:
-
Implement observability and budget tracking using:
i. CloudWatch Dashboards & Alarms for EC2, RDS, and CloudFront
ii. CloudTrail for auditing API actions and security events
iii. SSM Agent for EC2 log/metric extraction
iv. AWS Budgets for real-time cost monitoring and alerts
๐ Auto Scaling & Resilience:
-
To handle traffic spikes:
i. Created a Launch Template with baked-in user data and configuration
ii. Attached it to an Auto Scaling Group triggered by CPU > 60%
iii. This ensured our application could scale dynamically while maintaining performance.
๐ก Key Takeaways:
This project gave me hands-on experience with:
-
Designing secure and scalable cloud architectures
-
Implementing network isolation and encryption
-
Leveraging IAM, WAF, and KMS for cloud security
-
Using CloudWatch and CloudTrail for full-stack monitoring
-
Enabling cost-effective scaling strategies
This help successfully transition the application from a static, monolithic setup to a highly available and secure cloud-native infrastructure.
๐ Whatโs Next?
Weโre looking to explore:
-
CI/CD pipelines for automated deployments
-
Containerizing the app with ECS or EKS
-
Using IAM authentication for connecting with RDS
-
Dynamic caching using cloudfront