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?

gefragt vor 2 Jahren470 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren
  • Thank you, Dmitry. That worked. Regards

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

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen