Bootstrap FreeKB - Amazon Web Services (AWS) - Determine if an EC2 instance is associated with an Instance Profile using the AWS CLI
Amazon Web Services (AWS) - Determine if an EC2 instance is associated with an Instance Profile using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

An EC2 instance can only be associated with one instance profile. The aws ec2 describe-iam-instance-profile-associations command to determine if one of your EC2 instances is associated with an instance profile.

~]$ aws ec2 describe-iam-instance-profile-associations
{
    "IamInstanceProfileAssociations": [
        {
            "AssociationId": "iip-assoc-04a03786337a32660",
            "InstanceId": "i-0a3ea97aa2383de58",
            "IamInstanceProfile": {
                "Arn": "arn:aws:iam::123456789012:instance-profile/my-instance-profile",
                "Id": "AIPA2MITL76GNDM4CZFIM"
            },
            "State": "associated"
        }
    ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 2788a8 in the box below so that we can be sure you are a human.