I want view details of IAM Role to how many instances it is attached to with Cloudshell, cli which commands should use give example.
lets assume I have IAM Role TestRole I want to know to how ec2 instances TestRole is attached to.
I want view details of IAM Role to how many instances it is attached to with Cloudshell, cli which commands should use give example.
lets assume I have IAM Role TestRole I want to know to how ec2 instances TestRole is attached to.
Copyright © 2021 Jogjafile Inc.
You can use
aws ec2 describe-iam-instance-profile-associations
.It lists Amazon EC2 instances and their associated IAM Roles (the relationship is known as an Instance Profile).
Documentation: describe-instances — AWS CLI Command Reference
Example output:
I would recommend using this command to list all associations, and then check the
IamInstanceProfile
to determine whether it is using the IAM Role of interest.