How to check which IAM roles and it's policy json, are attached to the running EC2 instance?
Is it possible through AWS CLI?
Here the response for aws ec2 ddescribe-instances
I tried firing the command - aws iam list-instance-profiles,
it gave me the following error -
An error occurred (AccessDenied) when calling the ListInstanceProfiles operation: User: is not authorized to perform: iam:ListInstanceProfiles on resource:
No need to look for AWS CLI installed your Machine, Just machine should have internet and no block from metadata. You can curl the metadata from EC2:
curl -s http://169.254.169.254/latest/meta-data/iam/info |grep InstanceProfileArn | awk '{print $3}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With