pin-cnx/laravel-aws-deploy
Artisan command to deploy Laravel to AWS EC2 Auto Scaling with near zero downtime. Creates an AMI from a master instance, builds a new launch configuration, updates the ASG, spins up new instances, and can terminate old ones.
services.php), reducing friction for adoption.aws/aws-sdk-php v3+ changes).ec2backup executions, risking corrupted AMIs if multiple deployments overlap.IsTerminateCurrentInstance = true may cause data loss if not properly synchronized with Laravel’s deployment workflows (e.g., database migrations).queue:restart may not align with all Laravel deployments.EC2InstanceProfile for permissions.composer require pin-cnx/laravel-aws-deploy
services.php with profile-specific settings (e.g., staging, production).php artisan ec2backup --profile=staging and verify:
aws/aws-sdk-php to ^3.0.CreateImage → createImage).Illuminate\Console\Command.Artisan::call() usage.php artisan ec2backup after code is pushed to the master instance.DeployListener to hook into Laravel events (e.g., Deploying) for pre/post-deployment tasks.services.php updates may lead to environment inconsistencies. Consider:
EC2_INSTANCE_ID).401 Unauthorized: Verify IAM credentials and permissions.InvalidInstanceID.NotFound: Check if the master instance exists.php artisan ec2backup --verbose for detailed logs.t3.large) may take minutes to back up, increasing deployment time.HealthCheckGracePeriod).region config), but load balancer must be configured to distribute traffic across AZs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| AMI creation fails | Deployment blocked | Retry with --retry flag (if added) or manual AMI creation. |
| ASG update fails | Old instances remain | Manual ASG rollback via AWS Console. |
| Instance termination race condition | Data loss if stateful | Use shared storage (e.g., EFS) or sync data pre-deployment. |
| AWS API throttling | Deployment timeout | Implement **exponential |
How can I help you explore Laravel packages today?