Profile option on AmazonS3Client

0

The .NET client for AmazonS3Client has an option to pass 'Region' via its constructor. But I did not see an option for providing 'profile'. Is there a way of specifying profile?

posta 2 anni fa470 visualizzazioni
1 Risposta
2

Please refer to the documentation. You can specify a profile (either from the shared credentials file or from a custom file) by using the CredentialProfileStoreChain class and obtaining an AWSCredentials object:

var storeChain = new CredentialProfileStoreChain();
if (storeChain.TryGetAWSCredentials("some_profile", out var awsCredentials))
{
    // Use awsCredentials to create an Amazon S3 service client
    using var client = new AmazonS3Client(awsCredentials);
}
profile pictureAWS
con risposta 2 anni fa
  • Thank you, Dmitry. That worked. Regards

  • I'm glad my answer was helpful! You can also mark it as 'accepted'.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande