Generating PDFs locally can be resource intensive. If you're having to generate a lot of PDFs, or having troubles to install the necessary dependencies on your server, you may want to consider using AWS Lambda to generate your PDFs.
In order to generate PDFs on AWS Lambda, you must install these two packages in your app.
With these two packages installed, you can generate PDFs on AWS Lambda like this:
Pdf::view('pdf.invoice', $data)
->onLambda()
->save('invoice.pdf');
If you want to create all PDFs in your app on Lambda, you can set it as a default like this:
Pdf::default()->onLambda();