I'm trying to access some images stored in Amazon S3 by using .NET (C#) code. I've found no command to connect to a role in .NET. Normally there's a client-making method to access to an account as follows:
public static void Main()
{
client = new AmazonS3Client(accessKey,secretKey,bucketRegion);
ReadObjectDataAsync().Wait();
}
I wish there was an option to enter some sort of role credential in that new AmazonS3Client()
method.
When using web, I connect with my AWS account that doesn't have much rights and then I switch to a "role" that has access to the desired bucket and then I can download items directly from S3 web. I also can retrieve the canonical ID of the object using this command in CLI:
aws s3api list-objects --bucket DOC-EXAMPLE-BUCKET --prefix exampleprefix
In the credentials that I have received from our system admin I have: role_arn, source_profile, 2 different aws_access_key_id and 2 different aws_secret_access_key. I have tried with both pairs and I still receive Access Denied when reading object
.
I wrote a more extended version of my problem in regard to downloading items from S3 in this question:
How to download a list of files from AWS S3 with C# / .Net to my device?
Still, I have to say that I'm not really sure that the problem of access is because of role stuff. But nowhere in my C# code I have written anything to specify that I wish to connect via that particular role, and not just by connecting to my account. I don't know how to do that.