- What Laravel versions does the `laravel/vapor-cli` package support?
- The Vapor CLI is designed for Laravel 8.x through 10.x. Ensure your Laravel app is within this range before installation, as older versions may lack compatibility with Vapor’s serverless abstractions or AWS SDK dependencies.
- How do I install and set up the Vapor CLI for my Laravel project?
- Install via Composer with `composer require laravel/vapor-cli`. Then, authenticate by running `php artisan vapor:auth` and follow the prompts to link your AWS account. Ensure your AWS credentials have Vapor-specific IAM permissions for deployments.
- Can I use the Vapor CLI to manage databases like DynamoDB or RDS?
- Yes, the CLI supports provisioning and managing DynamoDB (serverless) and RDS (provisioned) databases. Use commands like `vapor:database:create` to set up resources, but note that schema migrations may require manual AWS Console adjustments for complex changes.
- Does the Vapor CLI handle AWS Lambda cold starts, and how can I mitigate them?
- The CLI abstracts Lambda deployments but doesn’t directly address cold starts. To mitigate, optimize your `composer.json` (remove unused dependencies), enable Provisioned Concurrency in the AWS Console, or use Vapor’s `vapor:function:update` to pre-warm functions.
- How do I deploy a Laravel app to Vapor using the CLI?
- Run `php artisan vapor:deploy` to push your app to Vapor. The CLI handles infrastructure provisioning, Lambda function updates, and environment configurations. Ensure your `vapor.yml` is properly configured for queues, databases, and networking before deployment.
- Are there alternatives to Vapor CLI for serverless Laravel deployments?
- For AWS Lambda, alternatives include Bref (Symfony-focused) or manual AWS SAM/CDK deployments. For non-AWS, consider Google Cloud Run or Azure Functions with custom tooling. Vapor CLI is unique for its Laravel-specific abstractions and tight Vapor integration.
- Can I use the Vapor CLI with Laravel queues (e.g., SQS or database drivers)?
- Yes, the CLI supports SQS queues and DynamoDB-based queues. Configure your queue connections in `.env` (e.g., `QUEUE_CONNECTION=sqs`), then use `vapor:queue:create` to provision SQS resources. For database queues, ensure your RDS/DynamoDB is properly set up.
- How do I configure Redis (ElastiCache) with the Vapor CLI?
- Use `php artisan vapor:redis:create` to provision an ElastiCache cluster. Update your Laravel config (`config/database.php`) to point to the generated Redis endpoint. The CLI handles VPC and security group configurations automatically during setup.
- What AWS permissions are required for the Vapor CLI to work?
- Your AWS IAM user/role needs permissions for Lambda, API Gateway, DynamoDB, RDS, ElastiCache, and CloudFront. Vapor provides a pre-configured IAM policy, but you may need to attach it manually if using custom roles. Test with `vapor:auth` to validate credentials.
- How do I roll back a deployment if something goes wrong with the Vapor CLI?
- Use `php artisan vapor:rollback` to revert to the previous deployment. Ensure your `vapor.yml` includes versioning for rollback support. For critical failures, manually revert Lambda functions via the AWS Console or use Vapor’s built-in rollback feature in the dashboard.