What Is Vapor?
Laravel Vapor is an auto-scaling, serverless deployment platform for Laravel, powered by AWS Lambda. Manage your Laravel infrastructure on Vapor and fall in love with the scalability and simplicity of serverless. Vapor abstracts the complexity of managing Laravel applications on AWS Lambda, as well as interfacing those applications with SQS queues, databases, Redis clusters, networks, CloudFront CDN, and more. Some highlights of Vapor’s features include:- Auto-scaling web / queue infrastructure fine tuned for Laravel
- Zero-downtime deployments and rollbacks
- Environment variable / secret management
- Database management, including point-in-time restores and scaling
- Redis Cache management, including cluster scaling
- Database and cache tunnels, allowing for easy local inspection
- Automatic uploading of assets to Cloudfront CDN during deployment
- Unique, Vapor assigned vanity URLs for each environment, allowing immediate inspection
- Custom application domains
- DNS management
- Certificate management and renewal
- Application, database, and cache metrics
- CI friendly
Requirements
Vapor requires that your application be compatible with PHP 7.3+ and Laravel 6.0+.Account Creation
Before integrating Vapor into your application, you should create a Vapor account. If you are just collaborating with others on their projects, you are not required to have a Vapor subscription. To create and manage your own projects, you will need a Vapor subscription.Installing The Vapor CLI
You will deploy your Laravel Vapor applications using the Vapor CLI. This CLI may be installed globally or on a per-project basis using Composer:vendor/bin
directory of your project, which is where Composer installs executables. For example, to view all of the available Vapor CLI commands, you may use the list
command:
To save keystrokes when interacting with per-project installations of the Vapor CLI, you may add a shell alias to your operating system that aliases the
vapor
command to php vendor/bin/vapor
.help
command with the name of the command you wish to explore:
Logging In
After you have installed the Vapor CLI, you should authenticate with your Vapor account using thelogin
command:
Installing The Vapor Core
Thelaravel/vapor-core
package must be installed as a dependency of every Laravel application that is deployed using Vapor. This package contains various Vapor runtime files and a service provider to allow your application to run on Vapor. You may install the Vapor Core into your project using Composer:
Sandbox Accounts
After creating a Vapor account, your account will be on our free “sandbox” plan, which allows you to experience the power of Vapor without the upfront commitment of subscribing to a paid plan. A sandbox account allows you to provision services such as networks, databases, and caches. You may add a single project which, once deployed, will be accessible via an AWS Lambda function URL.Sandbox projects may not utilize API Gateway versions, load balancers, firewalls, or custom domains. To utilize these features, you will need to choose a subscription plan.
Teams
When you create your Vapor account, a “Personal” team is automatically created for you. You can rename this team in your team settings. All projects, databases, caches, and other Vapor resources belong to a team. You are free to create as many teams as you wish via the Vapor UI or theteam
CLI command. There is no additional charge for creating teams, and they serve as a great way to organize your projects by client or topic.
Current Team & Switching Teams
When managing Vapor resources via the CLI, you will need to be aware of your currently active team. You may view your current team using theteam:current
command:
team:switch
command:
Collaborators
You can invite more people to your team via the “Team Settings” menu in the Vapor UI, or using theteam:add
CLI command. When you add a new collaborator to your team via the Vapor UI, you may select the permissions to assign to that person. For example, you can prevent a given team member from deleting databases or caches.
You may remove collaborators from your team using the Vapor UI or team:remove
CLI command.
Linking With AWS
In order to deploy projects or create other resources using Vapor, you will need to link an active AWS account on your team’s settings management page.Creating An IAM Role
To create a new IAM role, navigate to the IAM service on your AWS dashboard. Once you are in the IAM dashboard, you may select “Roles” from the left-side navigation panel and click the “Create Role” button. The process for creating the role is outlined in these steps:- Choose “AWS account” as the trusted entity type, and select “Another AWS account.”
- Enter the “Vapor Account ID” from the Vapor dashboard, then click “Next.”
- In the “Permissions policies” section, either grant full administrator access by selecting the
AdministratorAccess
policy or create a custom policy with the specific permissions required by Vapor. After selecting a policy, click “Next.” - In the “Name, review, and create” section, provide a name and description for the role.
- Update the “Trust policy” under “Select trusted entities” by enabling the “Require external ID” checkbox and entering the “Team External ID” shown in the Vapor dashboard.
- Complete the process by creating the role.
- Copy the role ARN displayed in the AWS dashboard and add it to your AWS credentials in Vapor.
Permissions
Since Vapor manages many types of resources across more than a dozen AWS services, it may be convenient to create a role with the
AdministratorAccess
policy. If desired, you may create a separate AWS account to house this role and contain all of your Vapor resources.It’s probable this list of permissions will change as we add new features to Vapor, which may result in unexpected errors if your policy is not kept up to date.
Defining Your AWS Budget
When linking your AWS account to Vapor, it is important to stay informed about your AWS costs. This can be done directly in the AWS Console using the AWS Budgets service. In addition, you can use Vapor’s managed budgets to define your monthly AWS budget in USD, while also configuring multiple alarms directly on the “Team Settings > AWS Accounts” screen of the Vapor UI. At this time, up to five alarms can be configured:- Actual cost > 85%
- Actual cost > 100%
- Actual cost > 200%
- Actual cost > 500%
- Forecasted cost > 100%
AWS Service Limits
AWS Service Limits can be increased through the following options:From the AWS console
From the AWS console
- Open the Service Quotas console.
- In the navigation pane, choose AWS services.
- Select a service.
- Select a quota.
- Follow the directions to request a quota increase.
From the AWS CLI
From the AWS CLI
- Use the request-service-quota-increase AWS CLI command.
From a support case
From a support case
- If a service is not yet available in Service Quotas, use the AWS Support Center Console to create a service quota increase case.
- If the service is available in Service Quotas, AWS recommends that you use the Service Quotas console instead of creating a support case.
For additional information, refer to the following AWS documentation:
- Requesting a quota increase in the Service Quotas User Guide.
- AWS Service Quotas reference.