aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

How to STS assume role

Open arash-cid opened this issue 2 years ago • 2 comments

System details (run the AWS: About Toolkit command)

In the Vscode AWS toolkit extension

Question

Can I set the toolkit to use one of my profiles, then get a session (STS Assumption) and show resources based on the assumed role?

image

arash-cid avatar Nov 02 '23 05:11 arash-cid

AWS Toolkit can use profiles defined with role_arn and source_profile https://github.com/aws/aws-toolkit-vscode/issues/620 . But Toolkit doesn't have special support for selecting a profile and then modifying its configuration. The profile needs to be configured in ~/.aws/credentials , then AWS Toolkit can use it.

set the toolkit to use one of my profiles, then get a session (STS Assumption)

Can you describe the exact steps that define "get a session". Are you using aws cli (what exact commands?)? Or are you expecting the Toolkit to have a feature that mimics the aws cli commands (what exact commands?).

justinmk3 avatar Nov 02 '23 16:11 justinmk3

Many times, we have a use case where we only have access to an account/resource by using one role/user as a source (which we set in our credentials and profile) and then assume another IAM role to access the resource.

So for instance, in cli we use aws sts assume-role --profile $SOURCE_PROFILE --role-arn $ROLE_ARN and then set AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, on the shell and environment variables to access the target resources.

It would be super useful if aws-toolkit could do the same and allow us to access the resources in the explorer after using the assumed role.

arash-cid avatar Nov 02 '23 23:11 arash-cid