What is the syntax for using a contrib module's service from within a hook implementation?
You can access services via \Drupal::service('service.name').
You need to know the service's name to access it, though. Looking at the s3fs module, I can see in the module's s3fs.services.yml file that the class your requesting is available with the service name s3fs.
$s3fs = \Drupal::service('s3fs');
$result = $s3fs-&gt;getAmazonS3Client($config);