'specifying the signature version of s3 client in aws sdk version 3

In aws-sdk v2 for javascript, we instantiate s3 client using:

var s3  = new AWS.S3({
          accessKeyId: 'YOUR-ACCESSKEYID' ,
          secretAccessKey: 'YOUR-SECRETACCESSKEY' ,
          s3ForcePathStyle: true,
          signatureVersion: 'v4'
});  

Here you can see the signatureVersion being able to be specified.

In v3 you instantiate the client using:

import { S3Client } from '@aws-sdk/client-s3';

credentials = {  
    accessKeyId: <ACCESS_KEY>,
    secretAccessKey: <SECRET_ACCESS_KEY>
  }
const client = new S3Client({
        region: 'us-east-1',
        credentials: credentials,
        forcePathStyle: true,
    })  

The docs aren't very clear (and without an example) on how to do this. How would I specify the signatureVersion for the client in this versin(v3) of the sdk?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source