How to upload dynamically generated PDF to AWS with Laravel?

I am generating a PDF dynamically with the DOMPDF in the Laravel and I have to save the document in the Cloud service of the Amazon.

I am not being able to save the document in the cloud . But I can only save locally.

    $pdf = PDF::loadView('contract.contract-pdf', $data);
    $pdf->save('contract.pdf');
    $s3 = \Storage::disk('s3');
    $s3->put('pdf/contract', new File('contract.pdf'), 'public');

How to send it to cloud?

Author: Edward Ramos, 2019-10-11