Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a role from an EC2 instance?

I launched an instance with an iam role

I now want to remove the role from the instance via powershell

I must be confused about the terminology here because I'm reading this doc and I don't see how to remove a role from an instance.

I want to run this command on the EC2 instance that the role will be removed from.

There can only be one role assigned to an instance so is there a way to dynamically get the iam role that has been assigned to an instance and remove it from the instance via the powershell api?

like image 557
red888 Avatar asked Oct 20 '25 09:10

red888


1 Answers

You can do that using AWS CLI (v1.11.46 or newer).

You can disassociate an IAM instance profile from a running or stopped instance using the disassociate-iam-instance-profile command.

See the disassociate-iam-instance-profile CLI command documentation for more details.

like image 158
Khalid T. Avatar answered Oct 22 '25 03:10

Khalid T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!