AWS BeanStalk is a serverless platform for Hosting and Scaling Web Applications. It Supports multiple Languages and Frameworks such as Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker.
Although just because it is compatible with PHP it doesn't mean a Laravel Application will run Out of the box and sometimes you need to run Laravel Artisan Commands.
How to Deploy.
Everything we need to know about this is available in AWS BeanStalk Official Documentation, available Here. Setting up AWS RDS and solving small problems are stated in the official docs.
How to Run Artisan Commands.
This is the part that's not explicitly mentioned in the docs. To run artisan commands, we can utilize the Elastic BeanStalk Commands with configuration files. All you must do is create a config file with the ".config" extension in your ".ebextensions" folder and put your commands under the container commands section. for example,
container_commands:
01-migration:
command: "php artisan migrate"
leader_only: true
02-seeding:
command: "php artisan db:seed"
leader_only: true
How to Edit NGINX Config file.
You can also make a config file name "laravel.conf" under".platform\nginx\conf.d\elasticbeanstalk\" in your application's root directory. in that file you can directly add the parts you want to add to your NGINX Config file. for example,
location / {
try_files $uri $uri/ /index.php?$query_string;
}