Skip to content

Assuming roles from php application running in Kubernetes cluster using IRSA #2706

Discussion options

You must be logged in to vote

Hi @wesbrownfavor, this behavior is expected. If we check the implementation here for assumeRoleWithWebIdentityCredentialProvider we will find that the parameter 'RoleArn' is never used, and that also the first role that is tried to be used is the one defined in AWS_ROLE_ARN. If you want to explicitly set which role you want to use when providing the credentials you could do the following:

use Aws\Credentials\AssumeRoleWithWebIdentityCredentialProvider;
use Aws\S3\S3Client;
use Aws\Sts\StsClient;

$providerFn = function ()  {
   $region = getenv('TEST_REGION');
   $stsClient = new StsClient([
       'version' => 'latest',
       'region' => $region
   ]);
   $provider = new AssumeRoleWith…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@wesbrownfavor
Comment options

@yenfryherrerafeliz
Comment options

Answer selected by wesbrownfavor
@wesbrownfavor
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
2 participants