Posted 2021-09-07 with tags Laravel, Laravel Vapor, AWS, AWS RDS

Laravel Vapor provides a CLI command (ex. vapor env:delete testing) to delete an environment. However the documentation for deleting an environment is a bit sparse and makes no mention that databases need to be deleted separately. So it's easy to end up in a state where you've deleted an environment, but forgotten to remove the associated AWS RDS database which is now orphaned and still adding to the AWS bill unnecessarily (confoundingly the AWS budget / cost explorer tools are famously terrible and anti-user which, although great for the AWS bottom line, adds to the probability of orphaned services being billed indefinitely).

So when deleting a Laravel Vapor environment, find the database name as specified in the vapor.yml config file and delete the database prior to running vapor env:delete, using the vapor database:delete command:

vapor database:delete testing-database

If you've already deleted the environment you'll run into an error when trying to delete the database after the fact (probably because the database reference no longer exists in the vapor.yml file):

vapor database:delete testing-database

Are you sure you want to delete this database (yes/no) [no]:
> y

Unable to find a database with that name / ID.

In this case you'll have to go into the AWS console and find the RDS instance and delete it manually (and hope you're not left with any other AWS services that may have been setup behind the scenes by Laravel Vapor when creating the database initially).