By using AWS re:Post, you agree to the Terms of Use

Profile option on AmazonS3Client


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 5 months ago46 views
1 Answer

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 picture
answered 5 months ago

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