Serverless hosting with AWS Vapor: scalability without server management.
AWS Vapor enables serverless deployment of Laravel applications without the need to manage servers. You only pay for what you use, scalability is automatic, and zero-downtime deployments are standard. In this article, you’ll learn how Vapor works, when it’s a viable option, and what you need to get started.
Serverless hosting with AWS Vapor: scalability without the hassle of server management.
AWS Vapor enables serverless deployment of Laravel applications without the need to manage servers. You only pay for what you use, scalability is automatic, and zero-downtime deployments are standard. In this article, you’ll learn how Vapor works, when it’s a viable option, and what you need to get started.
What is serverless hosting?
The name is a bit misleading. Servers aren’t going away. What’s going away is the responsibility for managing, patching, scaling, and monitoring them. Someone else—in this case, AWS—does that for you.
The servers are still there; you just don't manage them anymore.
With traditional hosting, you rent a VPS or dedicated server. You choose the size, install your stack, configure Nginx, manage SSL certificates, and decide for yourself how to scale. That gives you control, but it also comes with a management burden.
With serverless computing, you submit your application as code. The cloud provider decides when to launch an instance, how many instances are running, and when to shut them down. You pay per call and per millisecond of compute time, not for a server that sits idle half the time.
Pay-per-use versus fixed server costs.
For applications with fluctuating or unpredictable traffic, the difference is significant. A server that’s on standby for peak traffic costs money, even during off-peak hours. A serverless application costs nothing when no one is using it and automatically scales up if a thousand users suddenly log in at the same time.
How does AWS Vapor work with Laravel?
AWS Vapor is a deployment platform built specifically for Laravel. It converts your Laravel application to a serverless architecture on AWS, without requiring you to configure the underlying AWS services yourself.
AWS Lambda, S3, CloudFront, and RDS: the building blocks.
Vapor uses a combination of AWS services:
AWS Lambda executes your PHP application code, either on a per-request basis or via queues
Amazon S3 stores static files, uploads, and assets
CloudFront distributes those files worldwide via a CDN
Amazon RDS or RDS Proxy manages your database connections
Your Laravel application doesn't need to know anything about this infrastructure. Vapor handles the translation.
Zero-downtime deployments: how it works.
Every deployment in Vapor creates a new version of your Lambda function. As soon as the new version is ready, Vapor instantly switches traffic over to it. The old version remains available for a short period as a fallback. Your application is never offline during a deployment.
Manage the database and cache via the Vapor dashboard.
Vapor provides a dashboard that lets you manage databases (RDS), caches (ElastiCache), and queues (SQS). You don’t have to use the AWS console if you don’t want to. This lowers the barrier to entry for teams with Laravel experience but limited AWS expertise.
CDN, DNS, and SSL: all automated.
Vapor connects your domain, generates SSL certificates via AWS Certificate Manager, and configures CloudFront as a CDN. These are steps that must be set up and maintained manually with traditional hosting. With Vapor, they are included in the deployment pipeline by default.
Who is AWS Vapor suitable for?
SaaS platforms and e-commerce sites with unpredictable traffic.
If your platform experiences traffic spikes that are difficult to predict, serverless is a viable option. Consider a ticket sales platform that sees little traffic on quiet days but is flooded with traffic when a new release is launched. Or a B2B SaaS platform where usage depends on the business hours of clients in different time zones.
API integrations with high availability requirements.
Applications that serve as backends for mobile apps or external systems often have strict uptime requirements. Vapor’s automatic scalability and managed nature reduce the risk of downtime caused by overload.
When traditional servers are actually better.
Serverless isn't always the right choice. Applications with long-running processes (more than 15 minutes) don't fit the Lambda model. WebSocket connections require additional architectural work. And when costs are calculated based on high and consistent traffic volumes, a well-configured VPS is sometimes cheaper.
AWS Vapor: Pros and Cons.
AWS Vapor (Laravel Vapor) offers a combination of convenience, scalability, and serverless infrastructure. The key advantages and disadvantages are outlined below.
Costs
Advantage: You only pay for what you use. There is also a free tier available for small applications.
Disadvantage: With consistently high traffic, costs may end up being higher than with a fixed VPS solution. In addition, Vapor licensing costs are added to the AWS costs.
Scalability
Advantage: Scales up and down automatically without manual configuration.
Disadvantage: You have less control over how and when scaling occurs.
Management
Advantage: No server maintenance required, such as patches, infrastructure management, or SSL rotation.
Disadvantage: You are dependent on the AWS ecosystem, which can limit your flexibility.
Deployments
Advantage: Standard zero-downtime deployments, allowing updates to go live without interruption.
Disadvantage: Cold start latency may occur: the first request after a period of inactivity may be slower.
How do you get started with Vapor? First steps.
Create an AWS account and configure IAM permissions for Vapor
Install the Vapor CLI via Composer: composer global require laravel/vapor-cli
Create a vapor.yml file in your project with environment configuration
Configure the database and cache via the Vapor dashboard
Perform your first deployment: vapor deploy production
The first time, setup takes half a day, depending on the complexity of the application. After that, each deployment is completed with a single command.
Want to learn more about how AWS Vapor works for Laravel applications?
Worth reading next...
What is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) gives AI models controlled access to your systems. Read what MCP is, how it works and when you need it.
What is Single Source of Truth (SSOT?
Learn what SSOT means and how to implement it for reliable data integration in your organization
What is a configurator?
Which type of configurator fits your product? Cube builds custom product and 3D configurators with ERP integration. Discover the possibilities.
Questions? No problem.
With traditional hosting, you manage a server that runs continuously. With serverless computing, your application runs only when a request is received, and you pay per request. The cloud provider is responsible for maintaining the underlying infrastructure.
That depends on traffic patterns. With fluctuating or low average traffic, Vapor is almost always cheaper. With high and consistent traffic, a well-configured VPS may be more cost-effective. Be sure to calculate the costs for your specific situation.
Most standard Laravel applications work well on Vapor. Exceptions include applications with long-running synchronous processes (more than 15 minutes), persistent filesystem usage, or complex WebSocket requirements. These require additional architectural work or a hybrid solution.
A cold start occurs when Lambda launches a new instance after a period of inactivity. This can cause a delay of 200 to 500 milliseconds for the first request. For applications where latency is critical, you can configure provisioned concurrency to keep instances warm, at an additional cost.
Not native. WebSockets require a persistent connection, which is incompatible with Lambda’s stateless model. A hybrid approach is possible using the AWS API Gateway WebSocket API, but this requires additional architectural work beyond the standard Vapor configuration.