How to Deploy Laravel on AWS Elastic Beanstalk

How to Deploy Laravel on AWS Elastic Beanstalk

Written by
Written by

Sagar J.

Post Date
Post Date

Oct 29, 2025

shares

1_43XRibmQ_aHzD-ZyCDa3wA

Deploying Laravel on AWS might sound complex, but with AWS Elastic Beanstalk, it becomes smooth and automated. You can deploy your app, connect a managed database, secure it with SSL, and configure your custom domain — all from AWS’s intuitive web interface.

In this article, we’ll walk through the full Laravel deployment setup — covering Elastic BeanstalkRDSCertificate ManagerLoad Balancer, and Route 53.

No terminal commands, just form-based configuration and a ZIP upload.

What Is AWS Elastic Beanstalk?

Elastic Beanstalk (EBS) is a Platform-as-a-Service (PaaS) that automates application deployment and management. It supports several languages and frameworks, including PHP — making it perfect for Laravel.

Why Use Elastic Beanstalk for Laravel?

Explore Elastic Beanstalk: aws.amazon.com/elasticbeanstalk

AWS Services Overview

Here’s what we’ll use and why each service matters:

1_uHjLi1Xxo6o_6D7XUU-afQ

Why Each Service Matters

Step-by-Step Laravel Deployment Guide

Step 1: Prepare Your Laravel App

Before you upload your app:

1. Set APP_ENV=production and APP_DEBUG=false in .env

2. Run composer install --optimize-autoloader --no-dev locally.

3. Include your /vendor folder in the project.

4. Zip your entire Laravel project folder — including /app/public/vendor.env.example, and other required files.

💡 Tip: Your ZIP should look exactly like the folder structure Laravel expects in production.

Step 2: Create an Elastic Beanstalk Environment

1. Go to AWS Console → Elastic Beanstalk → Create Application.

2. Choose:
    — Platform: PHP
    — Environment type: Web server environment

3. Upload your Laravel .zip file.

4. Click Create Environment.

AWS will:

You’ll receive a default Beanstalk URL, e.g.

https://myapp.us-east-1.elasticbeanstalk.com

Step 3: Set Up a Managed Database (RDS)

1. Go to AWS Console → RDS → Create Database.

2. Select MySQL (or PostgreSQL).

3. Choose a Free Tier instance type (e.g. db.t3.micro).

4. Provide your database name, username, and password.

5. Make sure to select the same VPC as your Beanstalk app.

DB_CONNECTION=mysql DB_HOST=mydb.xxxxx.us-east-1.rds.amazonaws.com DB_PORT=3306 DB_DATABASE=laravel_db DB_USERNAME=admin DB_PASSWORD=secret

Step 4: Secure Your App with SSL (AWS Certificate Manager)

1. Navigate to AWS Certificate Manager (ACM).

2. Click Request a Certificate → Public Certificate.

3. Add your domain (example.com and www.example.com).

4. Choose DNS Validation (if using Route 53, AWS will create the record automatically).

5. Wait for the certificate status to show Issued.

✅ ACM certificates are freeauto-renewing, and integrate directly with Load Balancers.

Step 5: Enable HTTPS on Your Load Balancer

1. Go to Elastic Beanstalk → Configuration → Load Balancer.

2. Under Listeners, add a new listener for HTTPS (port 443).

3. Attach your newly issued ACM certificate.

4. Optionally, redirect all HTTP (port 80) traffic to HTTPS in .htaccess or via Load Balancer rules.

Your Laravel app now supports secure HTTPS connections.

Step 6: Connect Your Domain via Route 53

1. Go to Route 53 → Hosted Zones → Create Record.

2. Create an A Record (Alias).

3. Select Alias to Elastic Beanstalk Environment and choose your region and environment.

Your custom domain (e.g. myapp.com) now points to your Beanstalk-hosted Laravel app — with full SSL.

Important: Review AWS Pricing

Check Pricing:

Final Thoughts

By combining Elastic BeanstalkRDSACM, and Route 53, you get a production-ready Laravel environment that’s:

This architecture allows you to focus on your Laravel app instead of DevOps setup — ideal for startups, agencies, or solo developers.

Pro Tip: Before deploying to production, always check the AWS pricing pages linked above to ensure your setup fits your budget and region. It’s the best way to stay safe and cost-efficient.