Open
Description
While attempting to use the methodAssumeRoleWithWebIdentityAsync
which states ..does not require the use of Amazon Web Services security credentials..
it seems the default constructor for AmazonSecurityTokenServiceClient
in fact searches for credentials in a variety of places.
The following will throw Amazon.Runtime.AmazonServiceException : Unable to get IAM security credentials from EC2 Instance Metadata Service.
using var stsClient = new AmazonSecurityTokenServiceClient();
var response = await stsClient.AssumeRoleWithWebIdentityAsync(...)
It seems you must pass an "empty" set of credentials. This can, of course, be achieved in a number of ways. For example...
using var stsClient = new AmazonSecurityTokenServiceClient(new AnonymousAWSCredentials());
var response = await stsClient.AssumeRoleWithWebIdentityAsync(...)
This is perhaps a design issue, but maybe just some updated documentation might save developers some time.
Links
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SecurityToken/MSecurityTokenServicector.html