Skip to content

AmazonSecurityTokenServiceClient default constructor searches for credentials  #3016

Open
@puddlewitt

Description

@puddlewitt

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

https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SecurityToken/MSecurityTokenServiceAssumeRoleAssumeRoleRequest.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions