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?

asked 2 years ago463 views
1 Answer
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
answered 2 years ago
  • Thank you, Dmitry. That worked. Regards

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

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions