Skip to content

How to Get the Instance Profile attached to an AWS EC2

If you need to get the IAM Role information from the attached EC2 role directly, you can do the following:

IAM_ROLE=$(curl -s 169.254.169.254/latest/meta-data/iam/info | \ jq -r '.InstanceProfileArn' | cut -d'/' -f2)
Code language: Bash (bash)

See also  How to Extract the Files in a Docker Image
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x