How Do You Find which IAM Roles Your EC-2 User Account Has?

Problem scenario
You want to see what IAM permissions a given Linux user on an EC-2 instance has. You tried going to the web console for AWS. You were unable to find the user (e.g., ec2-user or ubuntu). How do you determine which roles the user is a member of?

Solution
From the OS, run this command:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access

Leave a comment

Your email address will not be published. Required fields are marked *