Self-hosting Magento on AWS gives you control Commerce Cloud does not - at the price of owning the architecture. This is the reference design we deploy for production stores: the services, the layout, and the decisions that matter. It is not the only valid architecture, but every piece in it has earned its place.
The Layout
Edge: CloudFront (or Cloudflare in front) for static assets and caching; ALB routing to the web tier. WAF on the ALB for bot and OWASP protection.
Web tier: EC2 Auto Scaling group across two availability zones, behind the ALB. Web nodes are stateless: no sessions, no media, no cache on local disk. Minimum two nodes always (AZ failure + deploy capacity), scaling on CPU.
Data tier:
- RDS MySQL Multi-AZ - the database is the one component you do not want to manage yourself
- ElastiCache Redis (separate endpoints for cache and sessions)
- OpenSearch Service for catalog search
Shared state:
- Media: S3 (via a Magento S3 module) or EFS shared across nodes. S3 is the better answer at scale; EFS is the simpler one
- Sessions/cache: Redis above - never local files on autoscaling nodes
- Deployments: artifact-based deploys to all nodes (CodeDeploy, or your pipeline’s SSH fan-out), then cache warm
The Decisions That Matter
Statelessness is the whole game. Every autoscaling horror story traces to state on web nodes - sessions, media, generated code. Centralise all three or do not autoscale.
NAT and networking: web and data tiers in private subnets; outbound via NAT gateway. The storefront should be unreachable except through the ALB.
Cron and consumers: a dedicated small “worker” node (or container) running cron and queue consumers - not one of the autoscaled web nodes, or jobs multiply across the fleet.
Staging parity: a smaller mirror of the same shape. Testing deploys against a single-node “staging” teaches you nothing about a multi-node production.
Cost Control
AWS bills punish inattention:
- Savings Plans or Reserved Instances for the baseline fleet (40-60 percent off on-demand)
- Autoscaling for the peaks instead of peak-sized always-on
- CloudFront offloading media - origin fetches are the expensive path
- Regular review of OpenSearch and RDS sizing - these two dominate most Magento AWS bills after EC2
The Honest Alternative
If reading this list felt like a lot: that is the argument for Commerce Cloud. AWS self-hosting pays when you have operational capability, unusual requirements, or scale where the cloud premium exceeds the team cost. Both are good answers for different merchants - pick with open eyes, not default momentum.
For those who stay: stateless web tier, managed data services, rehearsed deploys, and peak load tests. That is the whole discipline - and it is very achievable.