Skip to content
Back to blog
DevOps10 min read

How to deploy Laravel on AWS: step-by-step guide

A production-ready guide to deploying Laravel on AWS with EC2, RDS, Redis, S3 and CI/CD. Security, scaling and cost tips included.

How to deploy Laravel on AWS: step-by-step guide

Architecture overview

A production Laravel stack on AWS typically includes: EC2 or ECS for the application, RDS for MySQL/PostgreSQL, ElastiCache for Redis, S3 for file storage and CloudFront as CDN. Route 53 handles DNS and an Application Load Balancer distributes traffic.

This setup handles thousands of concurrent users with auto-scaling and multi-AZ redundancy for high availability.

Step 1: Provision infrastructure

Create a VPC with public and private subnets across two availability zones. Launch an RDS instance in private subnets. Create an ElastiCache Redis cluster. Set up an S3 bucket for uploads and configure IAM roles with least-privilege access.

Use Terraform or AWS CDK to codify everything. Never configure production infrastructure manually without version control.

Step 2: Deploy the Laravel application

Option A: EC2 with Laravel Forge or Envoyer for zero-downtime deploys. Option B: ECS Fargate with Docker containers for container-native workflows. Option C: Laravel Vapor for serverless deployment on Lambda.

Configure .env for production: APP_ENV=production, APP_DEBUG=false, queue connection to Redis, cache driver Redis, session driver Redis, filesystem disk s3. Run php artisan config:cache, route:cache and view:cache after deploy.

Step 3: CI/CD and monitoring

Set up GitHub Actions to run tests, build assets and deploy on merge to main. Add CloudWatch alarms for CPU, memory and error rates. Enable AWS WAF on the load balancer for DDoS protection.

Digilyo deploys Laravel on AWS for clients with full CI/CD, monitoring and cost optimisation. Need help with your first AWS deployment? Our DevOps team offers fixed-fee setup packages starting at $999.